Commit Graph

18864 Commits

Author SHA1 Message Date
Teodor Sigaev 26e6c896c9 Fix compiler warning "res may be used uninitialized in this function".
Actually, it can't but some compilers are not smart enough.
Per Peter Eisentraut gripe.
2008-11-19 10:23:21 +00:00
Peter Eisentraut 8b4da40487 Change this script to Perl 5 style. Add support for multiple refnames.
Sort the output by command name.  This previously only worked by source
file name, which doesn't always match the command name exactly.  And it
certainly won't work for multiple refnames.
2008-11-19 09:51:55 +00:00
Tom Lane 31ec957a15 Fix define_custom_variable so that SUSET custom variables behave
somewhat reasonably.  It's not perfect, but it beats the kluge
proposed in the auto-explain patch ...
2008-11-19 02:07:07 +00:00
Tom Lane cd35e9d746 Some infrastructure changes for the upcoming auto-explain contrib module:
* Refactor explain.c slightly to export a convenient-to-use subroutine
for printing EXPLAIN results.

* Provide hooks for plugins to get control at ExecutorStart and ExecutorEnd
as well as ExecutorRun.

* Add some minimal support for tracking the total runtime of ExecutorRun.
This code won't actually do anything unless a plugin prods it to.

* Change the API of the DefineCustomXXXVariable functions to allow nonzero
"flags" to be specified for a custom GUC variable.  While at it, also make
the "bootstrap" default value for custom GUCs be explicitly specified as a
parameter to these functions.  This is to eliminate confusion over where the
default comes from, as has been expressed in the past by some users of the
custom-variable facility.

* Refactor GUC code a bit to ensure that a custom variable gets initialized to
something valid (like its default value) even if the placeholder value was
invalid.
2008-11-19 01:10:24 +00:00
Magnus Hagander 667685ca7d Add required include to build with cygwin.
Andrew Chernow
2008-11-18 21:17:26 +00:00
Peter Eisentraut f426fbf746 Ident authentication over Unix-domain sockets on Solaris, using
getpeerucred() function.

Author: Garick Hamlin <ghamlin@isc.upenn.edu>
2008-11-18 13:10:20 +00:00
Teodor Sigaev 25ca5a9a54 Replace plain-memory ordered array by binary tree in ts_stat() function.
Performance is increased from 50% up to 10^3 times depending on data.
2008-11-17 12:17:09 +00:00
Tom Lane 18004101ac Modify UPDATE/DELETE WHERE CURRENT OF to use the FOR UPDATE infrastructure to
locate the target row, if the cursor was declared with FOR UPDATE or FOR
SHARE.  This approach is more flexible and reliable than digging through the
plan tree; for instance it can cope with join cursors.  But we still provide
the old code for use with non-FOR-UPDATE cursors.  Per gripe from Robert Haas.
2008-11-16 17:34:28 +00:00
Tom Lane 30f272a79b Add missing dependencies to preproc.y build rule 2008-11-15 22:20:55 +00:00
Andrew Dunstan f30a1d0474 Add missing semicolon, per grip from Alex Hunsaker. 2008-11-15 22:18:05 +00:00
Peter Eisentraut 8aad333f8f Fix crash of xmlconcat(NULL)
also backpatched to 8.3
2008-11-15 20:52:35 +00:00
Tom Lane 0656ed3daa Make SELECT FOR UPDATE/SHARE work on inheritance trees, by having the plan
return the tableoid as well as the ctid for any FOR UPDATE targets that
have child tables.  All child tables are listed in the ExecRowMark list,
but the executor just skips the ones that didn't produce the current row.

Curiously, this longstanding restriction doesn't seem to have been documented
anywhere; so no doc changes.
2008-11-15 19:43:47 +00:00
Magnus Hagander 772eedb6bb Exclude contrib/intagg from the list of MSVC project files to be generated,
since it's now just a SQL module and no C code.
2008-11-14 22:12:37 +00:00
Tom Lane 5c9c08d250 One more hack to see if we can get the cygwin machines building again.
This continues the saga of trying to get PGDLLIMPORT to work in pg_crc.h
in both backend and frontend environments.
2008-11-14 21:45:07 +00:00
Tom Lane 62533d34a5 Second try at fixing DLLIMPORT problem for pg_crc.h on Cygwin. 2008-11-14 20:21:07 +00:00
Tom Lane 9e0247aba5 In CREATE AGGREGATE, allow the transition datatype to be "internal", but only
if the user is superuser.  This makes available to extension modules the same
sort of trick being practiced by array_agg().  The reason for the superuser
restriction is that you could crash the system by connecting up an
incompatible pair of internal-using functions as an aggregate.  It shouldn't
interfere with any legitimate use, since you'd have to be superuser to create
the internal-using transition and final functions anyway.
2008-11-14 19:47:50 +00:00
Tom Lane fbaa172d65 ecpg's preproc.y is now generated as needed, so remove from CVS. 2008-11-14 17:43:14 +00:00
Tom Lane 4f38b9a80a Make CREATE CONVERSION verify that a putative encoding conversion function
returns VOID.  This is the last of the easy fixes I recommended in
11870.1218838360@sss.pgh.pa.us --- the others got done awhile ago but
I forgot about this one.
2008-11-14 17:40:56 +00:00
Tom Lane 1a0bbc296c Improve comment about when to clean generated files. 2008-11-14 17:18:20 +00:00
Michael Meskes b78f9b496d Enable script to generate preproc.y in build process. 2008-11-14 17:11:40 +00:00
Michael Meskes a76e98f021 Fixed test for output_filename == stdout. 2008-11-14 16:25:34 +00:00
Heikki Linnakangas f06b7604ca Fix oversight in previous error-reporting patch; mustn't pfree path string
before passing it to elog.
2008-11-14 11:09:50 +00:00
Peter Eisentraut d129255077 Set SQL man pages to be section 7 by default, and only transform them to
another section if required by the platform (instead of the old way of
building them in section "l" and always transforming them to the
platform-specific section).

This speeds up the installation on common platforms, and it avoids some
funny business with the man page tools and build process.
2008-11-14 10:22:48 +00:00
Michael Meskes e339ed5f50 Added files containing changes between gram.y and preproc.y. 2008-11-14 10:03:33 +00:00
Michael Meskes 4607c5ca56 Adding script that generates preproc.y from gram.y to CVS. 2008-11-14 10:01:04 +00:00
Tom Lane 81e11f2d05 Actually, instead of whining about how type internal might not safely store
a pointer, why don't we just fix that.  Every known use of "internal" really
means a pointer anyway.
2008-11-14 02:09:52 +00:00
Alvaro Herrera 03e5248d0f Replace the usage of heap_addheader to create pg_attribute tuples with regular
heap_form_tuple.  Since this removes the last remaining caller of
heap_addheader, remove it.

Extracted from the column privileges patch from Stephen Frost, with further
code cleanups by me.
2008-11-14 01:57:42 +00:00
Tom Lane c889ebce0a Implement the basic form of UNNEST, ie unnest(anyarray) returns setof
anyelement.  This lacks the WITH ORDINALITY option, as well as the multiple
input arrays option added in the most recent SQL specs.  But it's still a
pretty useful subset of the spec's functionality, and it is enough to
allow obsoleting contrib/intagg.
2008-11-14 00:51:47 +00:00
Tom Lane 5b9453bcd3 Minor code clarity improvements in array_agg functions, and add a comment
about how this is playing fast and loose with the type system.
2008-11-14 00:12:08 +00:00
Tom Lane 312d51798f Suppress leap-second-aware timezones in the output of pg_tzenumerate_next,
and thereby in the pg_timezone_names view.  Although we allow such zones
to be used in certain limited contexts like AT TIME ZONE, we don't allow
them in SET TIME ZONE, and bug #4528 shows that they're more likely to
confuse users than do anything useful.  So hide 'em.  (Note that we don't
even generate these zones when installing our own timezone database.
But they are likely to be present when using a system-provided database.)
2008-11-13 20:49:38 +00:00
Tom Lane 10e3acb8e7 Prevent synchronous scan during GIN index build, because GIN is optimized
for inserting tuples in increasing TID order.  It's not clear whether this
fully explains Ivan Sergio Borgonovo's complaint, but simple testing
confirms that a scan that doesn't start at block 0 can slow GIN build by
a factor of three or four.

Backpatch to 8.3.  Sync scan didn't exist before that.
2008-11-13 17:42:10 +00:00
Peter Eisentraut 3379fae6de array_agg aggregate function, as per SQL:2008, but without ORDER BY clause
Rearrange the documentation a bit now that array_agg and xmlagg have similar
semantics and issues.

best of Robert Haas, Jeff Davis, Peter Eisentraut
2008-11-13 15:59:51 +00:00
Tom Lane 69a0e2f76d PGDLLIMPORT-ize the global variables referenced in pg_crc.h.
I think this will fix current mingw buildfarm failures for pg_trgm.
2008-11-13 14:42:28 +00:00
Michael Meskes 53f93cbb20 Updated parser file to the one generated by the latest version of parse.[awk|pl] from the latest version of gram.y
Some small corrections to test suite.
2008-11-13 11:54:39 +00:00
Michael Meskes cd583703ea Removed two non-terminals:
- FloatOnly: only used by NumericOnly, instead put the FloatOnly production into NumericOnly
- IntegerOnly: only used by NumericOnly and one ALTER TABLE rule, replacement SignedIconst is already used in several other places
2008-11-13 11:10:06 +00:00
Magnus Hagander c89404edf3 Fix libpq certificate validation for SSL connections.
Add config parameter "sslverify" to control the verification. Default
is to do full verification.

Clean up some old SSL code that never really worked.
2008-11-13 09:45:25 +00:00
Tom Lane e7d8bfb934 Arrange to cache the results of looking up a btree predicate proof comparison
operator.  The result depends only on the two input operators and the proof
direction (imply or refute), so it's easy to cache.  This provides a very
large savings in cases such as Sergey Konoplev's long NOT-IN-list example,
where predtest spends all its time repeatedly figuring out that the same pair
of operators cannot be used to prove anything.  (But of course the O(N^2)
behavior still catches up with you eventually.)  I'm not convinced it buys
a whole lot when constraint_exclusion isn't turned on, but it's not a lot
of added code so we might as well cache all the time.
2008-11-13 00:20:45 +00:00
Tom Lane fdf8d0624a In predtest.c, install a limit on the number of branches we will process in
AND, OR, or equivalent clauses: if there are too many (more than 100) just
exit without proving anything.  This ensures that we don't spend O(N^2) time
trying (and most likely failing) to prove anything about very long IN lists
and similar cases.

Also, install a couple of CHECK_FOR_INTERRUPTS calls to ensure that a long
proof attempt can be interrupted.

Per gripe from Sergey Konoplev.

Back-patch the whole patch to 8.2 and just the CHECK_FOR_INTERRUPTS addition
to 8.1.  (The rest of the patch doesn't apply cleanly, and since 8.1 doesn't
show the complained-of behavior anyway, it doesn't seem necessary to work
hard on it.)
2008-11-12 23:08:37 +00:00
Alvaro Herrera 249b224bf5 Update URL to Ross Williams' CRC paper.
Per note from Devrim Gunduz
2008-11-12 21:53:46 +00:00
Michael Meskes 9e6976057c Do not use ICONST/SCONST in rules other than Iconst/Sconst. 2008-11-12 15:50:20 +00:00
Tom Lane e4ffd143a3 If we're going to use a SQL function for this, at least make it schema-proof. 2008-11-12 13:38:04 +00:00
Peter Eisentraut f98f6ee064 array_length() function, and for SQL compatibility also cardinality()
function as a special case.

This version still has the suspicious behavior of returning null for an
empty array (rather than zero), but this may need a wholesale revision of
empty array behavior, currently under discussion.

Jim Nasby, Robert Haas, Peter Eisentraut
2008-11-12 13:09:28 +00:00
Heikki Linnakangas 4c22564471 Fix off-by-one error in autovacuum shmem struct sizing. This could lead to
autovacuum worker sending SIGUSR1 signal to wrong process, per Zou Yong's
report.

Backpatch to 8.3.
2008-11-12 10:10:32 +00:00
Tom Lane d1ab3eb712 Clean up the ancient decision to show only two fractional-seconds digits
in "postgres_verbose" intervalstyle, and the equally arbitrary decision to
show at least two fractional-seconds digits in most other datetime display
styles.  This results in some minor changes in the expected regression test
outputs.

Also, coalesce a lot of repetitive code in datetime.c into subroutines,
for clarity and ease of maintenance.  In particular this roughly halves
the number of #ifdef HAVE_INT64_TIMESTAMP segments.

Ron Mayer, with some additional kibitzing from Tom Lane
2008-11-12 01:36:20 +00:00
Tom Lane 0d7099d2f0 Ensure that the phrels sets of PlaceHolderVars appearing in an AppendRelInfo's
translated_vars list get updated when pulling up an appendrel member.  It's
not clear that this really matters at present, since relatively little gets
done with the outputs of an appendrel child relation; but it probably will
come back to bite us sometime if we leave them with the wrong values.
2008-11-11 19:05:21 +00:00
Tom Lane 0436679969 Get rid of adjust_appendrel_attr_needed(), which has been broken ever since
we extended the appendrel mechanism to support UNION ALL optimization.  The
reason nobody noticed was that we are not actually using attr_needed data for
appendrel children; hence it seems more reasonable to rip it out than fix it.
Back-patch to 8.2 because an Assert failure is possible in corner cases.
Per examination of an example from Jim Nasby.

In HEAD, also get rid of AppendRelInfo.col_mappings, which is quite inadequate
to represent UNION ALL situations; depend entirely on translated_vars instead.
2008-11-11 18:13:32 +00:00
Magnus Hagander ccc9073f26 Make psql report "SSL connection (unknown cipher)" when libpq has set
up a SSL connection, but psql is compiled without support for it.

Not a really realistic use-case, but the patch also cuts down on
the number of places with #ifdef's...
2008-11-11 15:01:53 +00:00
Tom Lane cad3a26a95 Fix sloppy omission of now-required #include's. 2008-11-11 14:17:02 +00:00
Heikki Linnakangas 7e8b0b9ab1 Change error messages to print the physical path, like
"base/11517/3767_fsm", instead of symbolic names like "1663/11517/3767/1",
per Alvaro's suggestion. I didn't change the messages in the higher-level
index, heap and FSM routines, though, where the fork is implicit.
2008-11-11 13:19:16 +00:00
Michael Meskes c7f5c7c128 Replaced manually synced preproc.y by the one created by the new script.
Adapted regression test files accordingly.
2008-11-11 11:41:24 +00:00