Tom Lane [Mon, 6 Oct 2003 20:09:47 +0000 (20:09 +0000)]
Fix binary_oper_exact() so that the heuristic 'an unknown literal on
one side of a binary operator is probably supposed to be the same type
as the other operand' will be applied for domain types. This worked
in 7.3 but was broken in 7.4 due to code rearrangements. Mea culpa.
Tom Lane [Mon, 6 Oct 2003 16:38:28 +0000 (16:38 +0000)]
During ALTER TABLE ADD FOREIGN KEY, try to check the existing rows using
a single LEFT JOIN query instead of firing the check trigger for each
row individually. Stephan Szabo, with some kibitzing from Tom Lane and
Jan Wieck.
Michael Meskes [Mon, 6 Oct 2003 06:44:55 +0000 (06:44 +0000)]
- Fixed constant listing in execute using clause.
- Fixed typo in ecpg for Informix dec_t type.
- Fixed precision handling in Informix compat funxtions.
Tom Lane [Mon, 6 Oct 2003 02:38:53 +0000 (02:38 +0000)]
Modify COPY FROM to match the null-value string against the column value
before it is de-backslashed, not after. This allows the null string \N
to be reliably distinguished from the data value \N (which must be
represented as \\N). Per bug report from Manfred Koizar ... but it's
amazing this hasn't been reported before ...
Also, be consistent about encoding conversion for null string: the form
specified in the command is in the server encoding, but what is sent
to/from client must be in client encoding. This never worked quite
right before either.
Tom Lane [Mon, 6 Oct 2003 01:11:12 +0000 (01:11 +0000)]
Fix order of operations within SendQuery() so that the time spent in
data transfer during COPY is included in the \timing display. Also
avoid portability problems if tv_usec is unsigned on some platform.
Tom Lane [Sun, 5 Oct 2003 22:44:25 +0000 (22:44 +0000)]
Add a little more smarts to estimate_hash_bucketsize(): if there's no
statistics, but there is a unique index on the column, we can safely
assume it's well-distributed.
Tom Lane [Sat, 4 Oct 2003 21:05:21 +0000 (21:05 +0000)]
Document the always-true-but-previously-undocumented fact that PQfnumber()
will downcase the supplied field name unless it is double-quoted. Also,
upgrade the routine's handling of double quotes to match the backend,
in particular support doubled double quotes within quoted identifiers.
Per pgsql-interfaces discussion a couple weeks ago.
Tom Lane [Sat, 4 Oct 2003 18:22:59 +0000 (18:22 +0000)]
Fix pg_get_constraintdef() to ensure CHECK constraints are always shown
with required outer parentheses. Breakage seems to be leftover from
domain-constraint patches. This could be smarter about suppressing
extra parens, but at this stage of the release cycle I want certainty
not cuteness.
Bruce Momjian [Sat, 4 Oct 2003 18:19:57 +0000 (18:19 +0000)]
Modify:
< * Consider using MVCC to cache count(*) queries with no WHERE clause
> * Use a fixed row count and a +/- count with MVCC visibility rules
> to allow fast COUNT(*) queries with no WHERE clause(?)
Tom Lane [Fri, 3 Oct 2003 20:10:59 +0000 (20:10 +0000)]
Issue 'SET check_function_bodies = false' to suppress possible restore
failures in SQL functions, due to forward references or unqualified
references to objects in other schemas. Per recent discussion.
Tom Lane [Fri, 3 Oct 2003 19:26:49 +0000 (19:26 +0000)]
Add GUC parameter check_function_bodies to control whether validation
of function bodies is done at CREATE FUNCTION time. This is normally
true but can be set false to avoid problems with forward references,
wrong schema search path, etc. This is just the backend patch, still
need to adjust pg_dump to make use of it.
Tom Lane [Fri, 3 Oct 2003 18:26:14 +0000 (18:26 +0000)]
Cause PQescapeString to stop processing at a null character, rather
than generating an invalid output string. Per observation and patch
from Igor Shevchenko. Further code cleanup and documentation by
Tom Lane.
Tom Lane [Fri, 3 Oct 2003 17:04:48 +0000 (17:04 +0000)]
Remove assorted compilation failures introduced by latest ecpg changes.
Also remove -g, which has no business in CPPFLAGS in the first place,
let alone being hardwired there by a sub-Makefile.
Tom Lane [Thu, 2 Oct 2003 23:19:44 +0000 (23:19 +0000)]
Add a bit more locking to vac_update_relstats and vac_update_dbstats
to make them comparable to what UpdateStats does in the same situation.
I'm not certain two instances of vac_update_relstats could run in
parallel for the same relation, but parallel invocations of vac_update_dbstats
do seem possible.
Tom Lane [Thu, 2 Oct 2003 22:24:54 +0000 (22:24 +0000)]
When dumping CREATE INDEX, must show opclass name if the opclass isn't
in the schema search path. Otherwise pg_dump doesn't correctly dump
scenarios where a custom opclass is created in 'public' and then used
by indexes in other schemas.
Tom Lane [Thu, 2 Oct 2003 19:52:44 +0000 (19:52 +0000)]
Do not return from PQrequestCancel until postmaster has finished
processing the request; this ensures that the request won't be taken
to cancel a subsequently-issued query. Race condition originally
noted by Oliver Jowett in the context of JDBC, but libpq has it too.
Tom Lane [Thu, 2 Oct 2003 03:51:40 +0000 (03:51 +0000)]
Attached is a patch for contrib/tablefunc. It fixes two issues raised by
Lars Boegild Thomsen (full email below) and also corrects the regression
expected output for a recent backend message adjustment. Please apply.
Tom Lane [Wed, 1 Oct 2003 21:30:53 +0000 (21:30 +0000)]
Repair RI trigger visibility problems (this time for sure ;-)) per recent
discussion on pgsql-hackers: in READ COMMITTED mode we just have to force
a QuerySnapshot update in the trigger, but in SERIALIZABLE mode we have
to run the scan under a current snapshot and then complain if any rows
would be updated/deleted that are not visible in the transaction snapshot.
Tom Lane [Mon, 29 Sep 2003 23:40:26 +0000 (23:40 +0000)]
Adjust btree index build procedure so that the btree metapage looks
invalid (has the wrong magic number) until the build is entirely
complete. This turns out to cost no additional writes in the normal
case, since we were rewriting the metapage at the end of the process
anyway. In normal scenarios there's no real gain in security, because
a failed index build would roll back the transaction leaving an unused
index file, but for rebuilding shared system indexes this seems to add
some useful protection.
It's important that those brackets are there to (a) match all other
constraints and (b) so that people can just copy and paste them and it
will work as SQL.
Bruce Momjian [Mon, 29 Sep 2003 18:54:38 +0000 (18:54 +0000)]
I've not changed any malloc/calloc to palloc. It looks to me that these memory
areas are for the lifetime of the backend and in the interests of not breaking
something that's not broken I left alone.
Note for anyone reading this and wanting it for tsearch-v2-stable (i.e. for 7.3
backend) this patch probably will not apply cleanly to that source. It should
be simple enough to see what's going on and apply the changes by hand if need
be.
Bruce Momjian [Mon, 29 Sep 2003 18:22:48 +0000 (18:22 +0000)]
I discovered that TupleDescGetAttInMetadata and BuildTupleFromCStrings
don't deal well with tuples having dropped columns. The attached fixes
the issue. Please apply.
Bruce Momjian [Mon, 29 Sep 2003 18:21:33 +0000 (18:21 +0000)]
> >
> > a) Write documentation how the win32 console needs to be set up so that
> > psql can handle 8-bit characters.
> > Where should it be added? The Section "Installation on Windows" in the
> > Administrator's Guide seems natural to me.
> >
> > b) Add code to psql that prints a warning on startup of psql when the
> > console codepage differs from the windows codepage, something like
> >
> > Warning: Console codepage (850) differs from windows codepage (1252)
> > 8-bit characters will not work correctly. See PostgreSQL
> > documentation "Installation on Windows" for details.
>
Attached are two patches:
- installdoc.patch contains an additional paragraph on the win32 console
codepage for the chapter "Installation on Windows"
Due to a lack of SGML-tools, I have only edited the text and not tested
the SGML code - please check it before merging into the CVS branch.
- psqlcodepage.patch adds the warning about a problematic codepage to psql.
Tom Lane [Mon, 29 Sep 2003 00:21:58 +0000 (00:21 +0000)]
Fix broken definition of :print: character class, per Bruno Wolff.
Also, make :alnum: character class directly dependent on isalnum()
rather than guessing.
Tom Lane [Sun, 28 Sep 2003 23:37:45 +0000 (23:37 +0000)]
Restructure plpgsql's caching of 'simple' expression evaluation trees
to be less dangerous, and often faster as well. ExprState trees are
not kept across transaction boundaries; this eliminates problems with
resource leakage in failed transactions. But by keeping them in a
per-transaction EState, we can safely arrange for a single ExprState
to be shared by all the expression evaluations done in a given plpgsql
function call. (Formerly it seemed necessary to create and destroy an
ExprState for each exec_eval_simple_expr() call.) This saves time in
any scenario where a plpgsql function executes more than one expression.
Seems to be about as fast as 7.3 for simple cases, and significantly
faster for functions that do a lot of calculations.
Tom Lane [Sun, 28 Sep 2003 23:26:20 +0000 (23:26 +0000)]
Add a mechanism to let dynamically loaded modules register post-commit/
post-abort cleanup hooks. I'm surprised that we have not needed this
already, but I need it now to fix a plpgsql problem, and the usefulness
for other dynamically loaded modules seems obvious.
Tom Lane [Sun, 28 Sep 2003 02:11:23 +0000 (02:11 +0000)]
Now that we have UPDATE tab SET col = DEFAULT, get rid of horrid hack
in the RI triggers for ON DELETE/UPDATE SET DEFAULT. The code depended
way too much on knowledge of plan structure, and yet still would fail
if the generated query got rewritten by rules.