1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-31 03:21:24 +03:00

15448 Commits

Author SHA1 Message Date
Tom Lane
f23e9f7a54 Teach deparsing of CASE expressions to cope with the simplified forms
that simplify_boolean_equality() may leave behind.  This is only relevant
if the user writes something a bit silly, like CASE x=y WHEN TRUE THEN.
Per example from Michael Fuhr; may or may not explain bug #2106.
2005-12-10 19:21:17 +00:00
Peter Eisentraut
8c1fc987e4 Translation updates 2005-12-09 22:33:32 +00:00
Tom Lane
49d0ac4472 Fix core dump in error path of plpgsql_parse_tripwordtype. Somebody
introduced a copy-and-pasteo while trying to simplify the code.
2005-12-09 17:09:00 +00:00
Bruce Momjian
832bcfef55 I reconfirmed MS-VC6. Thank you for wonderful correspondence.
However, Another problem newly occurred.
This solves the problem of snprintf and vsnprintf.

Patch to HEAD and 8.1.X.

Hiroshi Saito
2005-12-09 04:50:50 +00:00
Bruce Momjian
96a1732710 Stamp 8.1.1. 2005-12-08 22:31:10 +00:00
Peter Eisentraut
061fecc50b Add missing translation marker 2005-12-08 21:17:46 +00:00
Tom Lane
bafe47497a Fix bgwriter's failure to release buffer pins and open files after an
error.  This probably explains bug #2099 and could also account for
mysterious VACUUM hangups.
2005-12-08 19:19:31 +00:00
Bruce Momjian
a3e1e99674 Disble some Win32-specific code in win32-client-only builds:
I have the problem, when building by MS-VC6.
An error occurs in the 8.1.0 present source codes.

nmake -f win32.mak
..\..\port\getaddrinfo.c(244) : error C2065: 'WSA_NOT_ENOUGH_MEMORY'
..\..\port\getaddrinfo.c(342) : error C2065: 'WSATYPE_NOT_FOUND'

This is used by winsock2.h. However, Construction of a windows base is
winsock.h.
Then, Since MinGW has special environment, this is right. but, it is not
found in VC6.
Furthermore, in getaddrinfo.c, IPV6-API is used by
LoadLibraryA("ws2_32");
Referring to of dll the external memory generates this violation by VC6
specification.

I considered whether the whole should have been converted into winsock2.
However, Now, DLL of MinGW creation operates wonderfully as it is.
That's right, it has pliability by replacement of simple DLL.
Then, I propose the system using winsock(non IPV6) in construction of
VC6.

Hiroshi Saito
2005-12-08 17:52:20 +00:00
Bruce Momjian
42860677a4 Add documentation on the use of *printf() macros and libintl.
Backpatch to 8.1.X.
2005-12-06 18:35:36 +00:00
Tom Lane
386f0e50ef In a nestloop inner indexscan, it's OK to use pushed-down baserestrictinfo
clauses even if it's an outer join.  This is a corner case since such
clauses could only arise from weird OUTER JOIN ON conditions, but worth
fixing.  Per example from Ron at cheapcomplexdevices.com.
2005-12-06 16:50:46 +00:00
Tom Lane
edae280e69 ecpg/pgtypeslib seems to need snprintf.c pulled in, too. 2005-12-06 05:26:30 +00:00
Tom Lane
24bc418969 Put undef's before extern declarations that need 'em, per Andrew Dunstan. 2005-12-06 05:13:56 +00:00
Tom Lane
f244c488fb Make Win32 build use our port/snprintf.c routines, instead of depending
on libintl which may or may not provide what we need.  Make a few marginal
cleanups to ensure this works.  Andrew Dunstan and Tom Lane.
2005-12-06 02:29:27 +00:00
Tom Lane
dc68b9ec30 Add regression test to see if the min/max values of int8 convert correctly. 2005-12-05 04:13:53 +00:00
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
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
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
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
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
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
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