Commit Graph

26806 Commits

Author SHA1 Message Date
Tom Lane c5f11f9d19 Fix a number of places that were making file-type tests infelicitously.
The places that did, eg,
	(statbuf.st_mode & S_IFMT) == S_IFDIR
were correct, but there is no good reason not to use S_ISDIR() instead,
especially when that's what the other 90% of our code does.  The places
that did, eg,
	(statbuf.st_mode & S_IFDIR)
were flat out *wrong* and would fail in various platform-specific ways,
eg a symlink could be mistaken for a regular file on most Unixen.

The actual impact of this is probably small, since the problem cases
seem to always involve symlinks or sockets, which are unlikely to be
found in the directories that PG code might be scanning.  But it's
clearly trouble waiting to happen, so patch all the way back anyway.
(There seem to be no occurrences of the mistake in 7.4.)
2008-03-31 01:31:43 +00:00
Tom Lane b65a509746 Show database access privileges in psql's \l command. For \l+, also show
database size, when available to the current user.

Andrew Gilligan
2008-03-30 18:10:20 +00:00
Tom Lane 2be368a5af Display incoming as well as outgoing foreign-key constraints in psql's
\d output for a table.

Kenneth D'Souza, some changes by myself.
2008-03-30 17:50:11 +00:00
Neil Conway 2169e42bef Enable 64-bit integer datetimes by default, per previous discussion.
This requires a working 64-bit integer type. If such a type cannot
be found, "--disable-integer-datetimes" can be used to switch
back to the previous floating point-based datetime implementation.
2008-03-30 04:08:15 +00:00
Tom Lane 2f6e61b8a6 Improve description of \du and \dg, per suggestion from
Harald Armin Massa.
2008-03-29 19:40:12 +00:00
Tom Lane 5787d50acc Improve psql's tab completion to handle completing attribute names in cases
where the relation name was schema-qualified, for example
	UPDATE foo.bar SET <tab>
Also support cases where the relation name was quoted unnecessarily,
for example
	UPDATE "foo" SET <tab>

Greg Sabino Mullane, slightly simplified by myself.
2008-03-29 19:19:14 +00:00
Tom Lane 6fc9d4272c Revert my erroneous fix for Taiki Yamaguchi's DISTINCT MAX() bug.
Whatever we do about that, this isn't the path to the solution.
2008-03-29 00:15:28 +00:00
Bruce Momjian 2b350bc585 Done:
> * -Add ability to trigger on TRUNCATE
2008-03-28 15:18:42 +00:00
Heikki Linnakangas 958db06181 Clarify documentation on PITR and warm standby on the fact that the standby
restore_command should report failure on non-existent .backup and .history
files. Tidy up some related text along the way.

Patch by Markus Bertheau, with some editing by Simon Riggs and myself.
2008-03-28 15:00:28 +00:00
Bruce Momjian da215f05ec Add to TODO:
>
> 	o Add CASE capability to language (already in SQL)
>
> 	  http://archives.postgresql.org/pgsql-hackers/2008-01/msg00696.php
>
>
2008-03-28 03:29:49 +00:00
Bruce Momjian 79262016a3 Add:
> * Allow one transaction to see tuples using the snapshot of another
>   transaction
>
>   This would assist multiple backends in working together.
>   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00400.php
2008-03-28 02:36:04 +00:00
Tom Lane 2e4094dad8 Department of second thoughts: the rule that ORDER BY and DISTINCT are
useless for an ungrouped-aggregate query holds regardless of whether
optimize_minmax_aggregates succeeds.  So we might as well apply the
optimization in any case.

I'll leave 8.3 as it was, since this version is a tad more invasive
than my earlier patch.
2008-03-28 02:00:11 +00:00
Tom Lane 7692d8d5b7 Support statement-level ON TRUNCATE triggers. Simon Riggs 2008-03-28 00:21:56 +00:00
Bruce Momjian 107b3d0c23 Add to TODO:
>
> * Consider being smarter about memory and external files used during
>   sorts
>
>   http://archives.postgresql.org/pgsql-hackers/2007-11/msg01101.php
>   http://archives.postgresql.org/pgsql-hackers/2007-12/msg00045.php
2008-03-27 20:37:43 +00:00
Bruce Momjian de44ecf860 Add URL for:
* Consider allowing control of upper/lower case folding of unquoted
  identifiers

>   http://archives.postgresql.org/pgsql-hackers/2008-03/msg00849.php
2008-03-27 20:31:04 +00:00
Tom Lane ff72280c9e When we have successfully optimized a MIN or MAX aggregate into an indexscan,
the query result must be exactly one row (since we don't do this when there's
any GROUP BY).  Therefore any ORDER BY or DISTINCT attached to the query is
useless and can be dropped.  Aside from saving useless cycles, this protects
us against problems with matching the hacked-up tlist entries to sort clauses,
as seen in a bug report from Taiki Yamaguchi.  We might need to work harder
if we ever try to optimize grouped queries with this approach, but this
solution will do for now.
2008-03-27 19:06:14 +00:00
Bruce Momjian 39627b1ae6 Remove ipcclean utility command --- didn't work on all Unixes and on
Windows.  Users should use their operating system tools instead.
2008-03-27 17:24:16 +00:00
Michael Meskes fe11719c2e Sorry, copied wrong files. 2008-03-27 08:40:02 +00:00
Michael Meskes 9d7b256eeb - Moved from PQsetdbLogin to PQconnectDB.
- Correctly parse connect options.
- Changed regression tests accordingly.
2008-03-27 07:56:02 +00:00
Tom Lane 039dfbfd5d Reduce the need for frontend programs to include "postgres.h" by refactoring
inclusions in src/include/catalog/*.h files.  The main idea here is to push
function declarations for src/backend/catalog/*.c files into separate headers,
rather than sticking them into the corresponding catalog definition file as
has been done in the past.  This commit only carries out that idea fully for
pg_proc, pg_type and pg_conversion, but that's enough for the moment ---
if pg_list.h ever becomes unsafe for frontend code to include, we'll need
to work a bit more.

Zdenek Kotala
2008-03-27 03:57:34 +00:00
Alvaro Herrera 73b0300b2a Move the HTSU_Result enum definition into snapshot.h, to avoid including
tqual.h into heapam.h.  This makes all inclusion of tqual.h explicit.

I also sorted alphabetically the includes on some source files.
2008-03-26 21:10:39 +00:00
Alvaro Herrera 78f02ca1f5 Rename snapmgmt.c/h to snapmgr.c/h, for consistency with other files.
Per complaint from Tom Lane.
2008-03-26 18:48:59 +00:00
Tom Lane 2d013c41a3 Fix bad spelling and worse grammar in recent doc commits. Propagate
pg_dump --ignore-version comments into pg_dumpall and pg_restore pages.
2008-03-26 16:34:47 +00:00
Alvaro Herrera d43b085d57 Separate snapshot management code from tuple visibility code, create a
snapmgmt.c file for the former.  The header files have also been reorganized
in three parts: the most basic snapshot definitions are now in a new file
snapshot.h, and the also new snapmgmt.h keeps the definitions for snapmgmt.c.
tqual.h has been reduced to the bare minimum.

This patch is just a first step towards managing live snapshots within a
transaction; there is no functionality change.

Per my proposal to pgsql-patches on 20080318191940.GB27458@alvh.no-ip.org and
subsequent discussion.
2008-03-26 16:20:48 +00:00
Magnus Hagander 2d7705e85e Include \password in the psql help.
While at it, change the order of the documented options to be
alphabetically again.
2008-03-26 15:24:56 +00:00
Bruce Momjian 9469d083e5 Improve documentation for odd array slice behavior. 2008-03-26 14:43:20 +00:00
Bruce Momjian c22de3989b Strengthen warnings about using pg_dump's -i option. 2008-03-26 14:32:22 +00:00
Bruce Momjian 530659fac8 Update TODO:
< 	o Consider invalidating the cache or keeping seperate cached
< 	  copies when search_path changes
> 	o Consider keeping seperate cached copies when search_path changes
2008-03-26 02:39:46 +00:00
Bruce Momjian 924fbc6eb8 Added to TODO:
>
> * Consider transaction start/end performance improvements
>
>   http://archives.postgresql.org/pgsql-hackers/2007-07/msg00948.php
>   http://archives.postgresql.org/pgsql-hackers/2008-03/msg00361.php
2008-03-26 01:49:51 +00:00
Tom Lane ff8a1204b4 Fix core dump in contrib/xml2's xpath_table() when the input query returns
a NULL value.  Per bug #4058.
2008-03-26 01:19:04 +00:00
Neil Conway c111a7211f Update documentation for recent DTrace changes. Patch from Robert Lor. 2008-03-25 22:50:27 +00:00
Tom Lane 220db7ccd8 Simplify and standardize conversions between TEXT datums and ordinary C
strings.  This patch introduces four support functions cstring_to_text,
cstring_to_text_with_len, text_to_cstring, and text_to_cstring_buffer, and
two macros CStringGetTextDatum and TextDatumGetCString.  A number of
existing macros that provided variants on these themes were removed.

Most of the places that need to make such conversions now require just one
function or macro call, in place of the multiple notational layers that used
to be needed.  There are no longer any direct calls of textout or textin,
and we got most of the places that were using handmade conversions via
memcpy (there may be a few still lurking, though).

This commit doesn't make any serious effort to eliminate transient memory
leaks caused by detoasting toasted text objects before they reach
text_to_cstring.  We changed PG_GETARG_TEXT_P to PG_GETARG_TEXT_PP in a few
places where it was easy, but much more could be done.

Brendan Jurd and Tom Lane
2008-03-25 22:42:46 +00:00
Bruce Momjian f948197b40 Done:
> * -Avoid tuple some tuple copying in sort routines
2008-03-25 20:18:18 +00:00
Neil Conway 1d812a98b4 Add a new tuplestore API function, tuplestore_putvalues(). This is
identical to tuplestore_puttuple(), except it operates on arrays of
Datums + nulls rather than a fully-formed HeapTuple. In several places
that use the tuplestore API, this means we can avoid creating a
HeapTuple altogether, saving a copy.
2008-03-25 19:26:54 +00:00
Bruce Momjian 76cf067ae4 Update TODO wording:
* Simplify integer cross-data-type operators
2008-03-25 13:09:39 +00:00
Alvaro Herrera ab20a8465a Reword Win32 rint() item, per Tom. 2008-03-25 12:55:38 +00:00
Alvaro Herrera 7726f6f337 Add URLs to previous discussions, per Simon. 2008-03-25 12:50:47 +00:00
Michael Meskes e427aa9080 added ECPGget_PGconn to exports.txt 2008-03-25 12:45:25 +00:00
Bruce Momjian 82694e2920 Add to TODO:
>
> * Add SQL-standard array_agg() and unnest() array functions
>
>   http://archives.postgresql.org/pgsql-hackers/2008-01/msg01017.php
>
2008-03-25 02:58:09 +00:00
Bruce Momjian d30ccbe2ae Add to pl/pgsql TODO:
>
> 	o Consider invalidating the cache or keeping seperate cached
> 	  copies when search_path changes
>
> 	  http://archives.postgresql.org/pgsql-hackers/2008-01/msg01009.php
2008-03-25 02:47:49 +00:00
Bruce Momjian 52346dadeb Add to TODO:
>
> * Add more cross-data-type operators
>
>   http://archives.postgresql.org/pgsql-bugs/2008-01/msg00189.php
2008-03-25 02:41:21 +00:00
Bruce Momjian c0e6ee3716 Add to TODO:
> * Detect deadlocks involving LockBufferForCleanup()
>
>   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00873.php
2008-03-25 02:38:34 +00:00
Bruce Momjian 697b0829b3 Add to psql TODO:
>
> 	o Improve display if enums
>
> 	  http://archives.postgresql.org/pgsql-hackers/2008-01/msg00826.php
>
>
2008-03-25 02:33:37 +00:00
Bruce Momjian 62c39d6dad Add to TODO:
>
> 	o Fix port/rint.c to be spec-compliant
>
> 	  http://archives.postgresql.org/pgsql-hackers/2008-01/msg00808.php
2008-03-25 02:23:43 +00:00
Bruce Momjian 2f31c72225 Add to TODO:
>
> * Consider sorting entries before inserting into btree index
>
>   http://archives.postgresql.org/pgsql-general/2008-01/msg01010.php
2008-03-25 02:17:17 +00:00
Bruce Momjian 43253b2152 Add to TODO:
>
> * Improve detection of shared memory segments being used by other
>   FreeBSD jails
>
>   http://archives.postgresql.org/pgsql-hackers/2008-01/msg00656.php
2008-03-25 02:11:22 +00:00
Bruce Momjian e8b350cee3 Add to TODO:
>
> * Move pgfoundry's xlogdump to /contrib and have it rely more closely
>   on the WAL backend code
>
>   http://archives.postgresql.org/pgsql-hackers/2007-11/msg00035.php
>
2008-03-25 00:42:23 +00:00
Bruce Momjian 3c8cbbd313 Add to TODO:
>
> * Have resource managers report the duration of their status changes
>
>   http://archives.postgresql.org/pgsql-hackers/2007-10/msg01468.php
2008-03-25 00:28:54 +00:00
Bruce Momjian 751f3d2f19 Add to TODO:
>
> * Be more aggressive about creating WAL files
>
>   http://archives.postgresql.org/pgsql-hackers/2007-10/msg01325.php
2008-03-25 00:14:53 +00:00
Bruce Momjian a24d3fdddd Add:
> 	o Prevent concurrent CREATE TABLE table1 from sometimes returning
> 	  a cryptic error message
>
> 	  http://archives.postgresql.org/pgsql-bugs/2007-10/msg00169.php
2008-03-25 00:11:48 +00:00