Commit Graph

10461 Commits

Author SHA1 Message Date
Tom Lane 82480e28f5 Fix things so that array_agg_finalfn does not modify or free its input
ArrayBuildState, per trouble report from Merlin Moncure.  By adopting
this fix, we are essentially deciding that aggregate final-functions
should not modify their inputs ever.  Adjust documentation and comments
to match that conclusion.
2009-06-20 18:45:28 +00:00
Heikki Linnakangas efa8544fd5 Fix a few errors in comments. Patch by Fujii Masao, plus the one in
visibilitymap.c by me.
2009-06-18 10:08:08 +00:00
Tom Lane f08e5e92e8 Fix the just-reported problem that you can't specify all four trigger event
types in CREATE TRIGGER.  While at it, clean up the amazingly tedious and
inextensible way that the trigger event type list was handled.  Per report
from Greg Sabino Mullane.
2009-06-18 01:27:02 +00:00
Tom Lane e8d78d35f4 ExecAgg() failed to finish running out set-returning functions in the last
aggregated tuple of a run.  Per report from Laurenz Albe.  This is a new
bug in 8.4, but only because prior versions rejected SRFs in an Agg plan
node altogether.
2009-06-17 16:05:34 +00:00
Tom Lane 5f6a14077b Fix get_sort_group_operators() so that it doesn't think arrays can be grouped
via hashing.  Eventually we ought to make that possible, but it won't happen
for 8.4.  Per yesterday's report from Robert Haas.
2009-06-13 15:42:09 +00:00
Tom Lane bfd06a713b Fix several places where a function was declared static and then defined
without static.  Per testing with a compiler that complains about this.
2009-06-12 16:17:29 +00:00
Tom Lane 44aa60fa7c Revisit AlterTableCreateToastTable's API once again, hoping to make it what
pg_migrator actually needs and not just a partial solution.  We have to be
able to specify the OID that the new toast table should be created with.
2009-06-11 20:46:11 +00:00
Tom Lane db16e77349 Remove our inadequate kluge that tried to get AIX's various broken versions
of getaddrinfo() to work.  Instead, recommend updating the OS to get a working
version of getaddrinfo.  Per recent discussions.
2009-06-11 19:00:15 +00:00
Tom Lane 0c19f05803 Fix things so that you can still do "select foo()" where foo is a SQL
function returning setof record.  This used to work, more or less
accidentally, but I had broken it while extending the code to allow
materialize-mode functions to be called in select lists.  Add a regression
test case so it doesn't get broken again.  Per gripe from Greg Davidson.
2009-06-11 17:25:39 +00:00
Tom Lane 772a074d4a Somebody seems to have thought they could get away without checking for
rsinfo->expectedDesc == NULL in deflist_to_tuplestore(), but that doesn't
look very safe to me.  Noted in passing while studying problem report
from Greg Davidson.
2009-06-11 16:14:18 +00:00
Bruce Momjian d747140279 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
2009-06-11 14:49:15 +00:00
Peter Eisentraut 0b7b908882 Translation updates 2009-06-10 23:42:44 +00:00
Peter Eisentraut 746c28a8e4 Improve capitalization and punctuation in recently added GiST message. 2009-06-10 20:02:15 +00:00
Tom Lane 61dd4185ff Keep rs_startblock the same during heap_rescan, so that a rescan of a SeqScan
node starts from the same place as the first scan did.  This avoids surprising
behavior of scrollable and WITH HOLD cursors, as seen in Mark Kirkwood's bug
report of yesterday.

It's not entirely clear whether a rescan should be forced to drop out of the
syncscan mode, but for the moment I left the code behaving the same on that
point.  Any change there would only be a performance and not a correctness
issue, anyway.

Back-patch to 8.3, since the unstable behavior was created by the syncscan
patch.
2009-06-10 18:54:16 +00:00
Tom Lane 2ef8c1acfd Fix cash_in() to behave properly in locales where frac_digits is zero,
eg Japan.  Report and fix by Itagaki Takahiro.  Also fix CASHDEBUG printout
format for branches with 64-bit money type, and some minor comment cleanup.

Back-patch to 7.4, because it's broken all the way back.
2009-06-10 16:31:32 +00:00
Peter Eisentraut 208d3a7555 Correct/improve the datetime_precision field in the information schema.
In particular, always show 0 for the date type instead of null, and show
6 (the default) for time, timestamp, and interval without a declared
precision.  This is now in fuller conformance with the SQL standard.

Also clarify the documentation about this.

discovered and analyzed by Konstantin Izmailov and Tom Lane
2009-06-10 07:03:34 +00:00
Tom Lane 5cca35a68b Make handling of INTERVAL DAY TO MINUTE and INTERVAL DAY TO SECOND input
more consistent with other cases, by having an unlabeled integer field
be treated as a number of minutes or seconds respectively.  These cases
are outside the spec (which insists on full "dd hh:mm" or "dd hh:mm:ss"
input respectively), so it's not much help to us in deciding what to do.
But with this change, it's uniformly the case that an unlabeled integer
will be considered as being a number of the interval's rightmost field.
The change also takes us back to the 8.3 behavior of throwing error
for certain ambiguous inputs such as INTERVAL '1 2' DAY TO MINUTE.
Per recent discussion.
2009-06-10 05:05:03 +00:00
Tom Lane 0dcc73fea4 Ensure xmlFree(NULL) is a no-op instead of a core dump. Per report from
Sergey Burladyan, there are at least some dank corners of libxml2 that
assume this behavior, even though their published documentation suggests
they shouldn't.

This is only really a live problem in 8.3, but the code is still there
for possible debugging use in HEAD, so patch both branches.
2009-06-10 03:44:35 +00:00
Peter Eisentraut 9b7304bc25 Fix xmlattribute escaping XML special characters twice (bug #4822).
Author: Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>
2009-06-09 22:00:57 +00:00
Alvaro Herrera e66576e58c Fix typo, per Tom 2009-06-09 19:36:28 +00:00
Tom Lane 59fb29cac6 Switch order of tests to avoid possible Assert failure for
"array_agg_finalfn(null)".  We should modify pg_proc entries to prevent this
query from being accepted, but let's just make the function itself secure too.
Per my note of today.
2009-06-09 18:15:04 +00:00
Alvaro Herrera e8f28cb25d Dynamically set a lower bound on autovacuum nap time so that we don't rebuild
the database list too often.

Per bug report from Łukasz Jagiełło and ensuing discussion on
pgsql-performance.
2009-06-09 16:41:02 +00:00
Tom Lane adaf60131f Fix failure to double-quote function argument names when needed, in
pg_get_function_arguments() and related functions.  Per report from
Andreas Nolte.
2009-06-09 14:36:06 +00:00
Peter Eisentraut c773ec6b15 Fix map_sql_table_to_xmlschema() with dropped attributes.
also backpatched to 8.3
2009-06-08 21:32:33 +00:00
Tom Lane 32ea236361 Improve the IndexVacuumInfo/IndexBulkDeleteResult API to allow somewhat sane
behavior in cases where we don't know the heap tuple count accurately; in
particular partial vacuum, but this also makes the API a bit more useful
for ANALYZE.  This patch adds "estimated_count" flags to both structs so
that an approximate count can be flagged as such, and adjusts the logic
so that approximate counts are not used for updating pg_class.reltuples.

This fixes my previous complaint that VACUUM was putting ridiculous values
into pg_class.reltuples for indexes.  The actual impact of that bug is
limited, because the planner only pays attention to reltuples for an index
if the index is partial; which probably explains why beta testers hadn't
noticed a degradation in plan quality from it.  But it needs to be fixed.

The whole thing is a bit messy and should be redesigned in future, because
reltuples now has the potential to drift quite far away from reality when
a long period elapses with no non-partial vacuums.  But this is as good as
it's going to get for 8.4.
2009-06-06 22:13:52 +00:00
Tom Lane 356eea24ce Fix a serious bug introduced into GIN in 8.4: now that MergeItemPointers()
is supposed to remove duplicate heap TIDs, we have to be sure to reduce the
tuple size and posting-item count accordingly in addItemPointersToTuple().
Failing to do so resulted in the effective injection of garbage TIDs into the
index contents, ie, whatever happened to be in the memory palloc'd for the
new tuple.  I'm not sure that this fully explains the index corruption
reported by Tatsuo Ishii, but the test case I'm using no longer fails.
2009-06-06 02:39:40 +00:00
Tom Lane 76d4abf2d9 Improve the recently-added support for properly pluralized error messages
by extending the ereport() API to cater for pluralization directly.  This
is better than the original method of calling ngettext outside the elog.c
code because (1) it avoids double translation, which wastes cycles and in
the worst case could give a wrong result; and (2) it avoids having to use
a different coding method in PL code than in the core backend.  The
client-side uses of ngettext are not touched since neither of these concerns
is very pressing in the client environment.  Per my proposal of yesterday.
2009-06-04 18:33:08 +00:00
Tom Lane a734979e0a Fix tsquerysel() to not fail on an empty TSQuery. Per report from
Tatsuo Ishii.
2009-06-03 18:42:13 +00:00
Tom Lane e550763121 Improve comment about 'if (1)' hack in copy.c macros. 2009-06-03 15:06:48 +00:00
Bruce Momjian 1a0ebe6152 Add comment about why "((void) 0)" is used in copy macros. 2009-06-03 14:48:33 +00:00
Heikki Linnakangas 7c8d7a2eec Only recycle normal files in pg_xlog as WAL segments. pg_standby creates
symbolic links with the -l option, and as Fujii Masao pointed out we ended up
overwriting files in the archive directory before this patch. Patch by
Aidan Van Dyk, Fujii Masao and me.

Backpatch to 8.3, where pg_standby was introduced.
2009-06-02 06:18:06 +00:00
Tom Lane bac2ad38ea Change AdjustIntervalForTypmod to not discard higher-order field values on the
grounds that they don't fit into the specified interval qualifier (typmod).
This behavior, while of long standing, is clearly wrong per spec --- for
example the value INTERVAL '999' SECOND means 999 seconds and should not be
reduced to less than 60 seconds.

In some cases there could be grounds to raise an error if higher-order field
values are not given as zero; for example '1 year 1 month'::INTERVAL MONTH
should arguably be taken as an error rather than equivalent to 13 months.
However our internal representation doesn't allow us to do that in a fashion
that would consistently reject all and only the cases that a strict reading
of the spec would suggest.  Also, seeing that for example INTERVAL '13' MONTH
will print out as '1 year 1 mon', we have to be careful not to create a
situation where valid data will fail to dump and reload.  The present patch
therefore takes the attitude of not throwing an error in any such case.
We might want to revisit that in future but it would take more redesign
than seems prudent in late beta.

Per a complaint from Sebastien Flaesch and subsequent discussion.  While
at other times we might have just postponed such an issue to the next
development cycle, 8.4 already has changed the parsing of interval literals
quite a bit in an effort to accept all spec-compliant cases correctly.
This seems like a change that should be part of that rather than coming
along later.
2009-06-01 23:55:15 +00:00
Tom Lane b3b89fd1f1 Fix DecodeInterval to report an error for multiple occurrences of DAY, WEEK,
YEAR, DECADE, CENTURY, or MILLENIUM fields, just as it always has done for
other types of fields.  The previous behavior seems to have been a hack to
avoid defining bit-positions for all these field types in DTK_M() masks,
rather than something that was really considered to be desired behavior.
But there is room in the masks for these, and we really need to tighten up
at least the behavior of DAY and YEAR fields to avoid unexpected behavior
associated with the 8.4 changes to interpret ambiguous fields based on the
interval qualifier (typmod) value.  Per my example and proposed patch.
2009-06-01 16:55:11 +00:00
Tom Lane 5377ccbe24 Update obsolete comment in index_drop(). When the comment was written,
queries frequently took no lock at all on individual indexes.  That's not
true any more, but we still need lock on the parent table to make it safe
to use cached lists of index OIDs.
2009-05-31 20:55:37 +00:00
Michael Meskes fa88e92a1d Change macros to make gcc quiet when parsing. 2009-05-29 13:54:52 +00:00
Heikki Linnakangas 2e6107cb62 When archiving is enabled, rotate the last WAL segment at shutdown so that
all transactions are archived.

Original patch by Guillaume Smet.
2009-05-28 11:02:16 +00:00
Magnus Hagander b1c2781951 Properly return the usermap result when doing gssapi authentication. Without
this, the username was in practice never matched against the kerberos principal
used to log in.
2009-05-27 21:08:22 +00:00
Tom Lane 6ec0753146 Ignore RECHECK in CREATE OPERATOR CLASS, just throwing a NOTICE, instead of
throwing an error as 8.4 had been doing.  The error interfered with porting
old database definitions (particularly for pg_migrator) without really buying
any safety.  Per bug #4817 and subsequent discussion.
2009-05-27 20:42:29 +00:00
Peter Eisentraut 9873db6646 Fix compiler warnings on Sun Studio of the sort
"tsquery_op.c", line 193: warning: syntax error:  empty declaration

Zdenek Kotala
2009-05-27 19:41:58 +00:00
Tom Lane 48938ab506 Allow the second argument of pg_get_expr() to be just zero when deparsing
an expression that's not supposed to contain variables.  Per discussion
with Gevik Babakhani, this eliminates the need for an ugly kluge (namely,
specifying some unrelated relation name).  Remove one such kluge from
pg_dump.
2009-05-26 17:36:05 +00:00
Tom Lane 99bf328237 Remove the useless and rather inconsistent return values of EncodeDateOnly,
EncodeTimeOnly, EncodeDateTime, EncodeInterval.  These don't have any good
reason to fail, and their callers were mostly not checking anyway.
2009-05-26 02:17:50 +00:00
Tom Lane dd96d13a77 Add range checks to time_recv() and timetz_recv(), to prevent binary input
of time values that would not be accepted via textual input.
Per gripe from Andrew McNamara.

This is potentially a back-patchable bug fix, but for the moment it doesn't
seem sufficiently high impact to justify doing that.
2009-05-26 01:29:09 +00:00
Tom Lane c3707a4fcd Use more-portable coding for the check on handing out the last available
relopt_kind value in add_reloption_kind().  Per Zdenek Kotala.
2009-05-24 22:22:44 +00:00
Tom Lane fc2660fc25 Fix LIKE's special-case code for % followed by _. I'm not entirely sure that
this case is worth a special code path, but a special code path that gets
the boundary condition wrong is definitely no good.  Per bug #4821 from
Andrew Gierth.

In passing, clean up some minor code formatting issues (excess parentheses
and blank lines in odd places).

Back-patch to 8.3, where the bug was introduced.
2009-05-24 18:10:38 +00:00
Teodor Sigaev c6c458e24d Resort tsvector's lexemes in tsvectorrecv instead of emmiting an error.
Basically, it's needed to support binary dump from 8.3 because ordering rule
was changed.

Per discussion with Bruce.
2009-05-21 20:09:36 +00:00
Michael Meskes ab9981ccc6 Removed comparison of unsigned expression < 0. 2009-05-21 12:54:27 +00:00
Heikki Linnakangas 7340793f31 Silence a gcc compiler warning about non-literal format string with no args
when compiling with -Wformat-security. Fujii Masao.
2009-05-20 08:48:10 +00:00
Heikki Linnakangas 9ca99cda21 Update relpages and reltuples estimates in stand-alone ANALYZE, even if
there's no analyzable attributes or indexes. We also used to report 0 live
and dead tuples for such tables, which messed with autovacuum threshold
calculations.

This fixes bug #4812 reported by George Su. Backpatch back to 8.1.
2009-05-19 08:30:00 +00:00
Tom Lane 7280fab717 Fix bug #4814 (wrong subscript in consistent-function call), and add some
minimal regression test coverage for matchPartialInPendingList().
2009-05-19 02:48:26 +00:00
Peter Eisentraut 5581f226c8 Update SQL conformance entries for window functions functionality 2009-05-18 12:04:59 +00:00