1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-22 23:02:54 +03:00

21700 Commits

Author SHA1 Message Date
Tom Lane
fcda95d987 Fix a rather sizable number of problems in our homegrown snprintf, such as
incorrect implementation of argument reordering, arbitrary limit of output
size for sprintf and fprintf, willingness to access more bytes than "%.Ns"
specification allows, wrong formatting of LONGLONG_MIN, various field-padding
bugs and omissions.  I believe it now accurately implements a subset of
the Single Unix Spec requirements (remaining unimplemented features are
documented, too).  Bruce Momjian and Tom Lane.
2005-12-05 02:39:43 +00:00
Tatsuo Ishii
3824460544 Two fixes from Tom Lan. See the posting "[PATCHES] A couple of
proposed pgbench changes" on 2005/11/29 for more details.

The change at line 490 updates doCustom's local variable "commands"
after selecting a new file (command sequence).  I think that the
existing coding will cause the thing to use the first command of the
old sequence in the remainder of the routine, which would be a bug.
I have not tried to set up a test case to prove it, though.

The other two changes cause doCustom to loop after processing a
meta-command.  This might be a bit controversial, but as the code
is currently written, each meta-command "costs" one cycle of the
outer select() loop.  Thus, for example, with the default TPC-B script,
once a backend returns "COMMIT" it will not receive a new command
until four cycles of issuing commands to other backends have elapsed.
(You can see this very easily by strace'ing pgbench under load.)
2005-12-04 01:22:42 +00:00
Tom Lane
a9bdac055c Fix out-of-order inclusion of -L switches from LDFLAGS on AIX and HPUX.
Per example from Dirk Pirschel.
2005-12-03 20:16:39 +00:00
Bruce Momjian
dfdec60447 Allow to_char(interval) and to_char(time) to use AM/PM specifications.
Map them to a single day, so '30 hours' is 'AM'.

Have to_char(interval) and to_char(time) use "HH", "HH12" as 12-hour
intervals, rather than bypass and print the full interval hours.  This
is neeeded because to_char(time) is mapped to interval in this function.
Intervals should use "HH24", and document suggestion.

Allow "D" format specifiers for interval/time.
2005-12-03 16:45:23 +00:00
Tom Lane
4ed2e803ef Fix obsolete description of -h option, per Andreas Schmidt. 2005-12-02 23:13:53 +00:00
Michael Meskes
43a10d3a16 Added special handling of CONNECTION variable that is used by ECPG instead of given to the backend.
I failed to notice that CONNECTION had become a keyword in 8.1.
2005-12-02 15:04:48 +00:00
Tom Lane
2913b95308 Rearrange code in ExecInitBitmapHeapScan so that we don't initialize the
child plan nodes until we have acquired lock on the relation to scan.
The relative order of initialization of plan nodes isn't real important in
other cases, but it's critical here because one is supposed to lock a
relation before its indexes, not vice versa.  The original coding was at
least vulnerable to deadlock against DROP INDEX, and perhaps worse things.
2005-12-02 01:30:26 +00:00
Tom Lane
3ece85f8bf Retry in FileRead and FileWrite if Windows returns ERROR_NO_SYSTEM_RESOURCES.
Also add a retry for Unixen returning EINTR, which hasn't been reported
as an issue but at least theoretically could be.  Patch by Qingqing Zhou,
some minor adjustments by me.
2005-12-01 20:24:31 +00:00
Tom Lane
963a811a67 Check for overflow in strtol() while parsing datetime inputs.
Michael Fuhr.
2005-12-01 17:56:43 +00:00
Neil Conway
bc0b56c0fe Fix typo in PL/PgSQL documentation, per Chris KL. 2005-12-01 10:38:09 +00:00
Tom Lane
29ebf0df81 Rearrange code in pg_atoi() to avoid assuming that isspace() cannot
change errno.  No reported bugs here, but why take a chance?
2005-11-30 23:10:16 +00:00
Tom Lane
2883fbb808 Tweak choose_bitmap_and() heuristics in the light of example provided in bug
#2075: consider an index redundant if any of its index conditions were already
used, rather than if all of them were.  Also, make the selectivity comparison
a bit fuzzy, so that very small differences in estimated selectivities don't
skew the results.
2005-11-30 17:10:25 +00:00
Michael Meskes
dd13bf167b - Made several variables "const char *" instead of "char *" as proposed by Qingqing Zhou <zhouqq@cs.toronto.edu>.
- Replaced all strdup() calls by ECPGstrdup().
2005-11-30 12:50:37 +00:00
Tom Lane
c4279b45fd Tweak hash join code to use an additional heuristic for deciding whether
it's worth probing the outer relation for emptiness before building the
hash table.  To wit, if we're rescanning a join previously performed,
remember whether we found it nonempty the previous time, and don't bother
with the probe if it was nonempty.  This buys back the performance lost
in examples like Mario Weilguni's.
2005-11-28 23:46:25 +00:00
Bruce Momjian
fc9b777a79 Improve documentation for COALESCE and NULLIF. Add references for NVL
and IFNULL.

Backpatch to 8.1.X.
2005-11-28 23:19:03 +00:00
Alvaro Herrera
8f105ad65c Install a more future-proof fix for the snapshot-unset bug just found.
Per suggestion from Tom Lane.
2005-11-28 17:23:12 +00:00
Tom Lane
7e3cdc631e Recent changes to allow hash join to exit early given empty input from
one child or the other had a problem: they did not leave the node in a
state that ExecReScanHashJoin would understand.  In particular it would
tend to fail to reset the child plans when needed.  Per report from
Mario Weilguni.
2005-11-28 17:14:47 +00:00
Alvaro Herrera
4123dbb75d Set a snapshot before running analyze on a single table, to avoid a
crash when analyzing tables with expressional indexes.
2005-11-28 13:34:10 +00:00
Tom Lane
73fa3d9a96 Add missing semicolon. Recent versions of bison seem to choke on this,
per buildfarm report from platypus, even though older versions let it pass.
2005-11-27 01:22:36 +00:00
Tom Lane
fd3ac58b68 Get rid of ExecAssignResultTypeFromOuterPlan() and make all plan node types
generate their output tuple descriptors from their target lists (ie, using
ExecAssignResultTypeFromTL()).  We long ago fixed things so that all node
types have minimally valid tlists, so there's no longer any good reason to
have two different ways of doing it.  This change is needed to fix bug
reported by Hayden James: the fix of 2005-11-03 to emit the correct column
names after optimizing away a SubqueryScan node didn't work if the new
top-level plan node used ExecAssignResultTypeFromOuterPlan to generate its
tupdesc, since the next plan node down won't have the correct column labels.
2005-11-23 20:28:05 +00:00
Tom Lane
f1e08506e9 Fix problems with rewriter failing to set Query.hasSubLinks when inserting
a SubLink expression into a rule query.  Pre-8.1 we essentially did this
unconditionally; 8.1 tries to do it only when needed, but was missing a
couple of cases.  Per report from Kyle Bateman.  Add some regression test
cases covering this area.
2005-11-23 17:21:22 +00:00
Tatsuo Ishii
45722010ef Having blank lines in -f scripts was causing silent failures.
per David Fetter
2005-11-23 13:23:34 +00:00
Bruce Momjian
bef7764835 Re-run pgindent, fixing a problem where comment lines after a blank
comment line where output as too long, and update typedefs for /lib
directory.  Also fix case where identifiers were used as variable names
in the backend, but as typedefs in ecpg (favor the backend for
indenting).

Backpatch to 8.1.X.
2005-11-22 18:23:31 +00:00
Tom Lane
c8de36352f Modify tuptoaster's API so that it does not try to modify the passed
tuple in-place, but instead passes back an all-new tuple structure if
any changes are needed.  This is a much cleaner and more robust solution
for the bug discovered by Alexey Beschiokov; accordingly, revert the
quick hack I installed yesterday.
With this change, HeapTupleData.t_datamcxt is no longer needed; will
remove it in a separate commit in HEAD only.
2005-11-20 18:38:42 +00:00
Tom Lane
efd2ae8f19 Stopgap solution for problem reported by Alexey Beschiokov: after
doing heap_insert or heap_update, wipe out any extracted fields in
the TupleTableSlot containing the tuple, because they might not be valid
anymore if tuptoaster.c changed the tuple.  Safe because slot must be
in the materialized state, but mighty ugly --- find a better answer!
2005-11-19 20:58:42 +00:00
Tom Lane
dccfa4d3f2 Fix performance issue in exprTypmod(): for a COALESCE expression, it
recursed twice on its first argument, leading to exponential time spent
on a deep nest of COALESCEs ... such as a deeply nested FULL JOIN would
produce.  Per report from Matt Carter.
2005-11-18 23:08:13 +00:00
Bruce Momjian
1012a93264 Update Japanese FAQ.
J.Kuwamura
2005-11-18 00:41:26 +00:00
Andrew Dunstan
eed9eb446a make psql honor explicit database parameter in -l mode, in case "postgres" database is missing - per complaint from Philip Yarra. 2005-11-17 23:49:44 +00:00
Tom Lane
be324ad2ab DropRelFileNodeBuffers failed to fix the state of the lookup hash table
that was added to localbuf.c in 8.1; therefore, applying it to a temp table
left corrupt lookup state in memory.  The only case where this had a
significant chance of causing problems was an ON COMMIT DELETE ROWS temp
table; the other possible paths left bogus state that was unlikely to
be used again.  Per report from Csaba Nagy.
2005-11-17 17:42:24 +00:00
Tom Lane
175ab4c00c make_restrictinfo() failed to attach the specified required_relids to
its result when the clause was an OR clause.  Brain fade exposed by
example from Sebastian BÎck.
2005-11-16 17:08:12 +00:00
Bruce Momjian
1cb945bd50 Properly document return value of strpos(). 2005-11-16 03:56:35 +00:00
Bruce Momjian
e68974665b Have test_fsync honor -f filename argument. 2005-11-16 01:31:14 +00:00
Bruce Momjian
b064cf0b7c Prevent certain symbols that are used for both typedefs and variable
names from being added to pgindent's typedef list.  The existance of
them caused weird formatting in the date/type files, and in keywords.c.

Backpatch to 8.1.X.
2005-11-15 14:45:14 +00:00
Bruce Momjian
b2625c13e0 Fix recent problems with BSD indent, including indenting past 80
columns, shifting comment to the right when more than 150 'else if'
clauses were used, and update typedefs for 8.1.X.

NetBSD patched updated, with documentation.
2005-11-15 01:02:13 +00:00
Tom Lane
659d3b2b0e Restore the former RestrictInfo field valid_everywhere (but invert the flag
sense and rename to "outerjoin_delayed" to more clearly reflect what it
means).  I had decided that it was redundant in 8.1, but the folly of this
is exposed by a bug report from Sebastian Böck.  The place where it's
needed is to prevent orindxpath.c from cherry-picking arms of an outer-join
OR clause to form a relation restriction that isn't actually legal to push
down to the relation scan level.  There may be some legal cases that this
forbids optimizing, but we'd need much closer analysis to determine it.
2005-11-14 23:54:36 +00:00
Alvaro Herrera
c42d633352 Translation typo fix 2005-11-14 22:08:29 +00:00
Bruce Momjian
2286192feb Re-run pgindent to fix breakage when exceeding 150 'else if' clauses.
Cosmetic fix only.
2005-11-14 17:46:07 +00:00
Tom Lane
431178ae67 Prevent ExecInsert() and ExecUpdate() from scribbling on the result tuple
slot of the topmost plan node when a trigger returns a modified tuple.
These appear to be the only places where a plan node's caller did not
treat the result slot as read-only, which is an assumption that nodeUnique
makes as of 8.1.  Fixes trigger-vs-DISTINCT bug reported by Frank van Vugt.
2005-11-14 17:43:13 +00:00
Tom Lane
f82df77c9d Force the second argument of SUBSTRING(foo FOR bar) to be int4, to avoid
surprising results when it's some other numeric type.  This doesn't solve
the generic problem of surprising implicit casts to text, but it's a
low-impact way of making sure this particular case behaves sanely.
Per gripe from Harald Fuchs and subsequent discussion.
2005-11-13 19:11:45 +00:00
Bruce Momjian
53de65af49 Revert pgindent length back to 79 because we are going to fix the BSD
indent bug.
2005-11-13 02:42:24 +00:00
Andrew Dunstan
6f90fd6948 add missing quote mark to ident_file sample line - per Hiroshi Saito 2005-11-10 14:02:59 +00:00
Tom Lane
52724454df When in transaction-aborted state, reject Bind message for portals containing
anything but transaction-exiting commands (ROLLBACK etc).  We already rejected
Parse and Execute in such cases, so there seems little point in allowing Bind.
This prevents at least an Assert failure, and probably worse things, since
there's a lot of infrastructure that doesn't work when not in a live
transaction.  We can also simplify the Bind logic a bit by rejecting messages
with a nonzero number of parameters, instead of the former kluge to silently
substitute NULL for each parameter.  Per bug #2033 from Joel Stevenson.
2005-11-10 00:31:40 +00:00
Tom Lane
067176b934 Fix misspelling of 'listen_addresses', per Devrim. 2005-11-09 17:44:15 +00:00
Alvaro Herrera
67b9e7f996 Translation updates. 2005-11-07 02:21:26 +00:00
Alvaro Herrera
1aa5e009d4 Translation updates. 2005-11-06 02:55:16 +00:00
PostgreSQL Daemon
2a80c3c4dc Tag everything for 8.1.0 ... Finally, a relesae on scheduale!! REL8_1_0 2005-11-05 04:01:57 +00:00
Tom Lane
48052de722 Repair an error introduced by log_line_prefix patch: it is not acceptable
to assume that the string pointer passed to set_ps_display is good forever.
There's no need to anyway since ps_status.c itself saves the string, and
we already had an API (get_ps_display) to return it.
I believe this explains Jim Nasby's report of intermittent crashes in
elog.c when %i format code is in use in log_line_prefix.
While at it, repair a previously unnoticed problem: on some platforms such as
Darwin, the string returned by get_ps_display was blank-padded to the maximum
length, meaning that lock.c's attempt to append " waiting" to it never worked.
2005-11-05 03:04:53 +00:00
Bruce Momjian
95af2633c3 Add mention to update FAQ item on most recent release to RELEASE_CHANGES. 2005-11-05 01:38:44 +00:00
Bruce Momjian
75a429463a Update FAQ for most recent release as 8.1. 2005-11-05 01:35:18 +00:00
Tom Lane
9ba4c42401 Yet another supported-platforms update. 2005-11-05 00:04:04 +00:00