Commit Graph

4671 Commits

Author SHA1 Message Date
Tom Lane fdc60bd9d9 Tweak pg_exec_query_string so that we close down transaction command
before reporting command-complete message for the final command of a
query string.  This way, any errors detected during finish_xact_command
(such as RI violations) will appear to be part of the final command,
rather than coming out after the command is reported complete.  This
avoids confusing PQendcopy and other not-overly-bright clients.
Per Lee Harr's bug report of 25-Feb-02.
2002-02-27 23:16:07 +00:00
Tom Lane 04cb9a6a16 Paranoia about data structure lifetime ... 2002-02-27 19:52:41 +00:00
Tom Lane 6779c55c22 Clean up BeginCommand and related routines. BeginCommand and EndCommand
are now both invoked once per received SQL command (raw parsetree) from
pg_exec_query_string.  BeginCommand is actually just an empty routine
at the moment --- all its former operations have been pushed into tuple
receiver setup routines in printtup.c.  This makes for a clean distinction
between BeginCommand/EndCommand (once per command) and the tuple receiver
setup/teardown routines (once per ExecutorRun call), whereas the old code
was quite ad hoc.  Along the way, clean up the calling conventions for
ExecutorRun a little bit.
2002-02-27 19:36:13 +00:00
Tatsuo Ishii 21f9a654f0 Fix bug in COPY FROM when DELIMITER is not in ASCII range.
See pgsql-bugs/pgsql-hackers discussion "COPY FROM is not 8bit clean"
around 2002/02/26 for more details -- Tatsuo Ishii
2002-02-27 01:34:41 +00:00
Tom Lane 56ee2ecba9 Restructure command-completion-report code so that there is just one
report for each received SQL command, regardless of rewriting activity.
Also ensure that this report comes from the 'original' command, not the
last command generated by rewrite; this fixes 7.2 breakage for INSERT
commands that have actions added by rules.  Fernando Nasser and Tom Lane.
2002-02-26 22:47:12 +00:00
Bruce Momjian f75e16d459 Fix for PAM error message display:
> and that the right fix is to make each of the subsequent calls be in
> this same pattern, not to try to emulate their nonsensical style.

Dominic J. Eidson
2002-02-25 20:07:02 +00:00
Thomas G. Lockhart c1911c94e9 Add a large number of time zones to the lookup table.
Fix a few apparently-wrong TZ vs DTZ declarations.
2002-02-25 16:17:04 +00:00
Bruce Momjian b4a09eaaad This patch will allow arbitrary levels of analyze / rewriting
by making the static variables extra_before and extra_after
automatic so we can use recursion.

It gets much easier to generate extra commands now, and one can rest
assured that the extra commands will be properly analyzed/rewritten.


Without this patch, if a command produced by transformation tries to
use these static lists their first contents would be lost with
unpredictable results.  I know I could fix this by just using nconc()
instead of assignments, but the resulting order of the commands would
not be exactly what one could expect.

--
Fernando Nasser
2002-02-25 04:21:55 +00:00
Bruce Momjian f5dff44736 I've attached a simple patch which should improve the performance of
hashname() and reduce the penalty incured when NAMEDATALEN is increased.
I posted this to -hackers a couple days ago, and there haven't been any
major complaints. It passes the regression tests. See -hackers for more
discussion, as well as the suggestion from Tom Lane on which this patch
is based.

Unless anyone sees any problems, please apply for 7.3.

Cheers,

Neil Conway
2002-02-25 04:06:52 +00:00
Bruce Momjian eb54314bb7 Re-add equals documentation with CREATE DATABASE. 2002-02-25 03:37:14 +00:00
Bruce Momjian 95ec9ff2f7 Remove documentation of equals in CREATE DATABASE. Mention removal of
equals hack for the future.
2002-02-25 02:53:46 +00:00
Tom Lane a833c441fd Add OWNER option to CREATE DATABASE, so superusers can create databases
on behalf of unprivileged users.  Also, make '=' optional in CREATE
DATABASE syntax.  From Gavin Sherry, with kibitzing and docs by Tom Lane.
2002-02-24 20:20:21 +00:00
Bruce Momjian 87675fab6f pgindent copy.c. Patch wasn't in proper format. 2002-02-24 02:33:33 +00:00
Bruce Momjian 0cd8cb1a03 Free files on dir open failure in COPY. 2002-02-24 02:32:26 +00:00
Bruce Momjian 5f644ea699 Add fstat / S_ISDIR checks to make sure we're not trying to use a
directory for COPY TO/FROM.

Brent Verner
2002-02-23 21:46:03 +00:00
Tom Lane 9a279da73d Guard against createdb --location=PGDATA foo; without this, the code
tries to create a symlink pointing at itself.  Per trouble report from
Kenneth McDowell.
2002-02-23 20:55:46 +00:00
Peter Eisentraut 42c3381fc7 Heimdal support (Kerberos V implementation from KTH) 2002-02-23 04:17:47 +00:00
Peter Eisentraut 51f195580f Save source of GUC settings, allowing different sources to be processed in
any order without affecting results.
2002-02-23 01:31:37 +00:00
Bruce Momjian ab786f6299 Make factorial(0) return 1, as per spec. 2002-02-23 01:01:30 +00:00
Tom Lane d9b01c13a6 Avoid failures in cash_out and cash_words for INT_MIN.
Also, 'fourty' -> 'forty'.
2002-02-19 22:19:34 +00:00
Tom Lane 2220a2b5d7 Add casts to suppress gcc warnings on Solaris (where apparently pid_t
is different from int).
2002-02-19 20:45:04 +00:00
Tom Lane 7863404417 A bunch of changes aimed at reducing backend startup time...
Improve 'pg_internal.init' relcache entry preload mechanism so that it is
safe to use for all system catalogs, and arrange to preload a realistic
set of system-catalog entries instead of only the three nailed-in-cache
indexes that were formerly loaded this way.  Fix mechanism for deleting
out-of-date pg_internal.init files: this must be synchronized with transaction
commit, not just done at random times within transactions.  Drive it off
relcache invalidation mechanism so that no special-case tests are needed.

Cache additional information in relcache entries for indexes (their pg_index
tuples and index-operator OIDs) to eliminate repeated lookups.  Also cache
index opclass info at the per-opclass level to avoid repeated lookups during
relcache load.

Generalize 'systable scan' utilities originally developed by Hiroshi,
move them into genam.c, use in a number of places where there was formerly
ugly code for choosing either heap or index scan.  In particular this allows
simplification of the logic that prevents infinite recursion between syscache
and relcache during startup: we can easily switch to heapscans in relcache.c
when and where needed to avoid recursion, so IndexScanOK becomes simpler and
does not need any expensive initialization.

Eliminate useless opening of a heapscan data structure while doing an indexscan
(this saves an mdnblocks call and thus at least one kernel call).
2002-02-19 20:11:20 +00:00
Tom Lane 8e2998d8a6 Remove some unnecessary pqsignal() calls to shave a few cycles off
backend startup.
2002-02-19 19:54:43 +00:00
Tom Lane 6e546c286c Arrange to call localtime() during postmaster startup. On most Unixen,
the first call of localtime() in a process will read /usr/lib/tztab or
local equivalent.  Better to do this once in the postmaster and inherit
the data by fork() than to have to do it during every backend start.
2002-02-19 19:53:35 +00:00
Tom Lane 9103372f52 Avoid calling pq_flush just after sending AUTH_REQ_OK; this saves one
send() and probable process context swap during backend startup.
2002-02-19 19:49:09 +00:00
Peter Eisentraut 8adf56f77a Privileges on functions and procedural languages 2002-02-18 23:11:58 +00:00
Tom Lane e4dd067398 Replace number-of-distinct-values estimator equation, per recent
pghackers discussion.
2002-02-18 16:04:14 +00:00
Bruce Momjian b4a5fa4518 Remove MAX/MIN() macros, use c.h Max/Min() instead. 2002-02-18 14:25:40 +00:00
Bruce Momjian d622cf867b Disable LIMIT #,# syntax, as agreed to months ago. Print message saying
to use separate LIMIT/OFFSET clauses.
2002-02-18 06:49:20 +00:00
Bruce Momjian 890a012d0a Reorder postgresql.conf WAL section to be clearer. 2002-02-18 06:42:54 +00:00
Bruce Momjian 5651a1665f Don't mention TIOGA in Makefile and move strdup.c rule into proper
'ifdef' in Makefile.
2002-02-18 06:03:23 +00:00
Bruce Momjian c448847378 Add better error text:
elog(LOG, "XLogWrite: new log file created - "
                     "consider increasing 'wal_files' in postgresql.conf.");
2002-02-18 05:44:45 +00:00
Tom Lane 3576820e78 Ensure that a cursor is scanned under the same scanCommandId it was
originally created with, so that the set of visible tuples does not
change as a result of other activity.  This essentially makes PG cursors
INSENSITIVE per the SQL92 definition.  See bug report of 13-Feb-02.
2002-02-14 15:24:10 +00:00
Tom Lane fa046b6a92 Use RTLD_NOW, not RTLD_LAZY, as binding mode for dlopen() on all platforms.
This restores the Linux behavior to what it was in PG 7.0 and 7.1, and
causes other platforms to agree.  (Other well-tested platforms like HPUX
were doing it this way already.)  Per pghackers discussion over the past
month or so.
2002-02-12 23:41:25 +00:00
Tom Lane 9832a235c5 Modify COPY TO to emit carriage returns and newlines as backslash escapes
(backslash-r, backslash-n) for protection against newline-conversion
munging.  In future we will also tweak COPY FROM, but this part of the
change should be backwards-compatible.  Per pghackers discussion.
Also, update COPY reference page to describe the backslash conversions
more completely and accurately.
2002-02-12 21:25:41 +00:00
Tom Lane 028e13bc08 Tweak GiST code to work correctly on machines where 8-byte alignment
of pointers is required.  Patch from Teodor Sigaev per pghackers
discussion.  It's an ugly kluge but avoids forcing initdb; we'll put
a better fix into 7.3 or later.
2002-02-11 22:41:59 +00:00
Peter Eisentraut 2bd15ad0bc Fix for old FreeBSD versions that don't have RTLD_GLOBAL 2002-02-11 21:38:11 +00:00
Tom Lane 6799a6ca21 Repair problems with EvalPlanQual where target table is scanned as
inner indexscan (ie, one with runtime keys).  ExecIndexReScan must
compute or recompute runtime keys even if we are rescanning in the
EPQ case.  TidScan seems to have comparable problems.  Per bug
noted by Barry Lind 11-Feb-02.
2002-02-11 20:10:50 +00:00
Tom Lane d99fb0d909 Don't Assert() that fsync() and close() never fail; I have seen this
crash on Solaris when over disk quota.  Instead, report such failures
via elog(DEBUG).
2002-02-10 22:56:31 +00:00
Bruce Momjian dbb76bf2e0 Move sys/types.h to top, for hiroyuki hanai/ FreeBSD. 2002-02-08 16:30:11 +00:00
Tom Lane 0cc9917bb6 pgstat's truncation of query string needs to be multibyte-aware.
Patch from sugita@sra.co.jp.
2002-02-07 22:20:26 +00:00
Hiroshi Inoue e206ff5946 Removed a check for REINDEX TABLE. 2002-02-07 00:27:30 +00:00
Tom Lane bef0c8dc29 Add cast to suppress gcc warning on Darwin platform. 2002-01-30 19:34:55 +00:00
Peter Eisentraut 0d6813df4e Updates from Serguei Mokhov 2002-01-26 19:00:11 +00:00
Tom Lane 386f1809a7 Fix logic error in insert_fsm_page_entry: because compact_fsm_page_list
removes any empty chunks, the chunk previously added won't be there
anymore, so it's possible there is zero free space in the rel's page list
afterwards.  Must loop back and rerun the part that adds a chunk to
the list.
2002-01-24 15:31:43 +00:00
Peter Eisentraut 0363192c69 Update from Kova'cs Zolta'n 2002-01-18 21:25:00 +00:00
Tom Lane b7bf03c9ed Fix misstatements added by Bruce. 2002-01-16 23:51:56 +00:00
Bruce Momjian d781138235 Add more comments to tqual.c for visibility functions. 2002-01-16 23:09:09 +00:00
Tom Lane cf97080fa4 TOAST needs to do at least minimal time-qual checking in order not to
mess up after an aborted VACUUM FULL, per today's pghackers discussion.
Add a suitable HeapTupleSatisfiesToast routine.  Remove useless special-
case test in HeapTupleSatisfiesVisibility macro for xmax =
BootstrapTransactionId; perhaps that was needed at one time, but it's
a waste of cycles now, not to mention actively wrong for SnapshotAny.
Along the way, add some much-needed comments to tqual.c, and simplify
toast_fetch_datum, which no longer needs to assume it may see chunks
out-of-order.
2002-01-16 20:29:02 +00:00
Tom Lane 0f2d949c1e Fix init_irels to close the pg_internal.init file before returning.
This saves one open file descriptor per backend, and avoids an
annoying NOTICE on Cygwin (which has trouble deleting open files).
Bug appears to date back to original coding of init_irels, circa 1992.
2002-01-16 17:34:42 +00:00