Commit Graph

26614 Commits

Author SHA1 Message Date
Magnus Hagander ad6bf716ba Convert three more guc settings to enum type:
default_transaction_isolation, session_replication_role and regex_flavor.
2008-04-02 14:42:56 +00:00
Bruce Momjian afa2a9ec9c Remove due to survey/discussion:
<
< * Prefix command-line utilities like createuser with 'pg_'
<
<   http://archives.postgresql.org/pgsql-hackers/2007-06/msg00025.php
<
2008-04-02 02:11:47 +00:00
Tom Lane e2a8804330 Support EXECUTE USING in plpgsql.
Pavel Stehule, with some improvements by myself.
2008-04-01 03:51:09 +00:00
Tom Lane d5466e38f0 Add SPI-level support for executing SQL commands with one-time-use plans,
that is commands that have out-of-line parameters but the plan is prepared
assuming that the parameter values are constants.  This is needed for the
plpgsql EXECUTE USING patch, but will probably have use elsewhere.

This commit includes the SPI functions and documentation, but no callers
nor regression tests.  The upcoming EXECUTE USING patch will provide
regression-test coverage.  I thought committing this separately made
sense since it's logically a distinct feature.
2008-04-01 03:09:30 +00:00
Tom Lane 6b73d7e567 Fix an oversight I made in a cleanup patch over a year ago:
eval_const_expressions needs to be passed the PlannerInfo ("root") structure,
because in some cases we want it to substitute values for Param nodes.
(So "constant" is not so constant as all that ...)  This mistake partially
disabled optimization of unnamed extended-Query statements in 8.3: in
particular the LIKE-to-indexscan optimization would never be applied if the
LIKE pattern was passed as a parameter, and constraint exclusion depending
on a parameter value didn't work either.
2008-04-01 00:48:33 +00:00
Tom Lane d344115519 Apply my original fix for Taiki Yamaguchi's bug report about DISTINCT MAX().
Add some regression tests for plausible failures in this area.
2008-03-31 16:59:26 +00:00
Tom Lane e86237ff31 Fix my brain fade in TRUNCATE triggers patch: can't release relcache refcounts
while EState still contains pointers to those relations.  Exposed by the
CLOBBER_CACHE_ALWAYS tests that buildfarm member jaguar is running (I knew
those cycles would pay off...)
2008-03-31 03:34:27 +00:00
Tom Lane 3405f2b925 Use error message wordings for permissions checks on .pgpass and SSL private
key files that are similar to the one for the postmaster's data directory
permissions check.  (I chose to standardize on that one since it's the most
heavily used and presumably best-wordsmithed by now.)  Also eliminate explicit
tests on file ownership in these places, since the ensuing read attempt must
fail anyway if it's wrong, and there seems no value in issuing the same error
message for distinct problems.  (But I left in the explicit ownership test in
postmaster.c, since it had its own error message anyway.)  Also be more
specific in the documentation's descriptions of these checks.  Per a gripe
from Kevin Hunter.
2008-03-31 02:43:14 +00:00
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