Commit Graph

5896 Commits

Author SHA1 Message Date
Tom Lane 39e98d9563 Repair sometimes-incorrect computation of StartUpID after a crash, per
example from Rao Kumar.  This is a very corner corner-case, requiring
a minimum of three closely-spaced database crashes and an unlucky
positioning of the second recovery's checkpoint record before you'd notice
any problem.  But the consequences are dire enough that it's a must-fix.
2003-05-22 14:39:28 +00:00
Tom Lane 0b5b3e9e65 Fix coredump in pg_get_triggerdef, ensure function name is schema-
qualified when necessary, simplify argument-printing code.
2003-05-20 20:35:10 +00:00
Peter Eisentraut f89c972ac8 Add documentation for information schema, and some corrections on some
views.
2003-05-18 20:55:57 +00:00
Tom Lane 6d7ff848e5 Add code to test for unknown timezone names (following some ideas from
Ross Reedstrom, a couple months back) and to detect timezones that are
using leap-second timekeeping.  The unknown-zone-name test is pretty
heuristic and ugly, but it seems better than the old behavior of just
switching to GMT given a bad name.  Also make DecodePosixTimezone() a
tad more robust.
2003-05-18 01:06:26 +00:00
Bruce Momjian 9ea764a0dc Remove use of geteuid under Win32. 2003-05-16 02:40:19 +00:00
Tom Lane 9e43184b9d Add missing #include. 2003-05-15 19:34:46 +00:00
Bruce Momjian 09aad5a3a6 Add copydir() function because xcopy doesn't work in XP without a
window.
2003-05-15 17:59:17 +00:00
Bruce Momjian 12c9423832 Allow Win32 to compile under MinGW. Major changes are:
Win32 port is now called 'win32' rather than 'win'
        add -lwsock32 on Win32
        make gethostname() be only used when kerberos4 is enabled
        use /port/getopt.c
        new /port/opendir.c routines
        disable GUC unix_socket_group on Win32
        convert some keywords.c symbols to KEYWORD_P to prevent conflict
        create new FCNTL_NONBLOCK macro to turn off socket blocking
        create new /include/port.h file that has /port prototypes, move
          out of c.h
        new /include/port/win32_include dir to hold missing include files
        work around ERROR being defined in Win32 includes
2003-05-15 16:35:30 +00:00
Peter Eisentraut 2c0556068f Indexing support for pattern matching operations via separate operator
class when lc_collate is not C.
2003-05-15 15:50:21 +00:00
Tom Lane 2a2f6cfa39 Fix oversight: ignore-till-SYNC state should not ignore EOF ... 2003-05-14 18:40:37 +00:00
Tom Lane f85f43dfb5 Backend support for autocommit removed, per recent discussions. The
only remnant of this failed experiment is that the server will take
SET AUTOCOMMIT TO ON.  Still TODO: provide some client-side autocommit
logic in libpq.
2003-05-14 03:26:03 +00:00
Tom Lane d9b679c13a In RowDescription messages, report columns of domain datatypes as having
the type OID and typmod of the underlying base type.  Per discussions
a few weeks ago with Andreas Pflug and others.  Note that this behavioral
change affects both old- and new-protocol clients.
2003-05-13 18:39:50 +00:00
Tom Lane 0249c24235 More binary I/O routines. 2003-05-13 18:03:08 +00:00
Tom Lane 1c9ac7dfd0 Change pg_amop's index on (amopclaid,amopopr) to index (amopopr,amopclaid).
This makes no difference for existing uses, but allows SelectSortFunction()
and pred_test_simple_clause() to use indexscans instead of seqscans to
locate entries for a particular operator in pg_amop.  Better yet, they can
use the SearchSysCacheList() API to cache the search results.
2003-05-13 04:38:58 +00:00
Tom Lane 30f609484d Add binary I/O routines for a bunch more datatypes. Still a few to go,
but that was enough tedium for one day.  Along the way, move the few
support routines for types xid and cid into a more logical place.
2003-05-12 23:08:52 +00:00
Tom Lane b02832719c Avoid unnecessary copying of parameter values in BIND. This allows
efficient insertion of large bytea values through the BIND interface.
2003-05-12 16:48:17 +00:00
Tom Lane d97c9b3662 Apply fixes for problems with dropped columns whose types have also been
dropped.  The simplest fix for INSERT/UPDATE cases turns out to be for
preptlist.c to insert NULLs of a known-good type (I used INT4) rather
than making them match the deleted column's type.  Since the representation
of NULL is actually datatype-independent, this should work fine.
I also re-reverted the patch to disable the use_physical_tlist optimization
in the presence of dropped columns.  It still doesn't look worth the
trouble to be smarter, if there are no other bugs to fix.
Added a regression test to catch future problems in this area.
2003-05-12 00:17:03 +00:00
Tom Lane 6f261461c1 Revert previous change --- turns out the underlying problem affects
more cases than I thought, so ExecTypeFromTL() will have to be fixed
anyway.
2003-05-11 20:25:50 +00:00
Tom Lane 8f2e53bc10 Disable the recently-added use_physical_tlist optimization in cases
where the table contains dropped columns.  If the columns are dropped,
then their types may be gone as well, which causes ExecTypeFromTL() to
fail if the dropped columns appear in a plan node's tlist.  This could
be worked around but I don't think the optimization is valuable enough
to be worth the trouble.
2003-05-11 15:03:52 +00:00
Tom Lane a4e775a263 Make use of new error context stack mechanism to allow random errors
detected during buffer dump to be labeled with the buffer location.
For example, if a page LSN is clobbered, we now produce something like
ERROR:  XLogFlush: request 2C000000/8468EC8 is not satisfied --- flushed only
to 0/8468EF0
CONTEXT:  writing block 0 of relation 428946/566240
whereas before there was no convenient way to find out which page had
been trashed.
2003-05-10 19:04:30 +00:00
Tom Lane ecc8c3652e In child-crashed log messages, identify a checkpoint process as such
instead of calling it a 'server process'.
2003-05-10 18:15:42 +00:00
Tom Lane 8d86a96068 Adjust CreateCheckpoint so that buffer dumping activities and cleanup of
dead xlog segments are not considered part of a critical section.  It is
not necessary to force a database-wide panic if we get a failure in these
operations.  Per recent trouble reports.
2003-05-10 18:01:31 +00:00
Tom Lane ba1e066e46 Implement array_send/array_recv (binary I/O for arrays). This exposed
the folly of not passing element type to typsend/typreceive, so fix that.
2003-05-09 23:01:45 +00:00
Tom Lane b1ee615a7f COPY BINARY uses the new binary I/O routines. Update a few more datatypes
so that COPY BINARY regression test passes.
2003-05-09 21:19:50 +00:00
Tom Lane 38d9919d1a Now that fastpath protocol allows null arguments to be passed,
fastpath.c had better check for strict functions.
2003-05-09 18:18:54 +00:00
Tom Lane 0ac6298bb8 Implement new-protocol binary I/O support in DataRow, Bind, and FunctionCall
messages.  Binary I/O is now up and working, but only for a small set
of datatypes (integers, text, bytea).
2003-05-09 18:08:48 +00:00
Bruce Momjian 3afb84cd0f Remove another old rint() replacement. 2003-05-09 16:31:24 +00:00
Bruce Momjian 0afe5417d7 Add rint() to /port, remove from qnx/. 2003-05-09 16:26:29 +00:00
Bruce Momjian 995773be1c Pass canAcceptConnections to exec'ed backend, for Jan. 2003-05-09 15:57:24 +00:00
Tom Lane 5ecd4e3f30 Binary send/receive routines for a few basic datatypes --- enough for
testing purposes.
2003-05-09 15:44:42 +00:00
Tom Lane 45d04099df Reinstate pg_type's typsend and typreceive columns. They don't do much
yet, but they're there.  Also some editorial work on CREATE TYPE reference
page.
2003-05-08 22:19:58 +00:00
Bruce Momjian f2c7a27635 Write non-defaults file before signalling the children to reread it. 2003-05-08 20:43:07 +00:00
Bruce Momjian 789a5b340c Move attached to shared memory out into a separate function for clarity. 2003-05-08 19:17:07 +00:00
Tom Lane 075a0078df I think we're done with protocol instability, so mark server and libpq
as speaking the one true 3.0 protocol.
2003-05-08 18:33:39 +00:00
Tom Lane c0a8c3ac13 Update 3.0 protocol support to match recent agreements about how to
handle multiple 'formats' for data I/O.  Restructure CommandDest and
DestReceiver stuff one more time (it's finally starting to look a bit
clean though).  Code now matches latest 3.0 protocol document as far
as message formats go --- but there is no support for binary I/O yet.
2003-05-08 18:16:37 +00:00
Bruce Momjian 5e7a5c9511 Pass shared memory address on command line to exec'ed backend.
Allow backends to attached to specified shared memory address.
2003-05-08 14:49:04 +00:00
Bruce Momjian 07d35e4277 Change alternate database location patch to test for symlink() rather
than WIN32.
2003-05-07 03:47:08 +00:00
Bruce Momjian d9fd7d12f6 Pass shared memory id and socket descriptor number on command line for
fork/exec.
2003-05-06 23:34:56 +00:00
Tom Lane 755d191700 Add display of eventual result RowDescription (if any) to the output
of Describe on a prepared statement.  This was in the original 3.0
protocol proposal, but I took it out for reasons that seemed good at
the time.  Put it back per yesterday's pghackers discussion.
2003-05-06 21:51:42 +00:00
Tom Lane 8f6a6b7e9a Ensure that an Execute operation can't send tuples in cases where
Describe would claim that no tuples will be returned.  Only affects
SELECTs added to non-SELECT base queries by rewrite rules.  If you
want to see the output of such a select, you gotta use 'simple Query'
protocol.
2003-05-06 21:01:04 +00:00
Tom Lane 79913910d4 Restructure command destination handling so that we pass around
DestReceiver pointers instead of just CommandDest values.  The DestReceiver
is made at the point where the destination is selected, rather than
deep inside the executor.  This cleans up the original kluge implementation
of tstoreReceiver.c, and makes it easy to support retrieving results
from utility statements inside portals.  Thus, you can now do fun things
like Bind and Execute a FETCH or EXPLAIN command, and it'll all work
as expected (e.g., you can Describe the portal, or use Execute's count
parameter to suspend the output partway through).  Implementation involves
stuffing the utility command's output into a Tuplestore, which would be
kind of annoying for huge output sets, but should be quite acceptable
for typical uses of utility commands.
2003-05-06 20:26:28 +00:00
Bruce Momjian 3ad406bbc9 Rename internal variables DBName|dbName to dbname, for consistency. 2003-05-06 05:15:45 +00:00
Bruce Momjian 77a0219ab1 Comment out some of the conditional tests until we have exec().
Reorder non-default variable loading until PGDATA is defined.
2003-05-06 04:16:35 +00:00
Tom Lane 2cf57c8f8d Implement feature of new FE/BE protocol whereby RowDescription identifies
the column by table OID and column number, if it's a simple column
reference.  Along the way, get rid of reskey/reskeyop fields in Resdoms.
Turns out that representation was not convenient for either the planner
or the executor; we can make the planner deliver exactly what the
executor wants with no more effort.
initdb forced due to change in stored rule representation.
2003-05-06 00:20:33 +00:00
Tom Lane 94a3c60324 Ditch ExecGetTupType() in favor of the much simpler ExecGetResultType(),
which does the same thing.  Perhaps at one time there was a reason to
allow plan nodes to store their result types in different places, but
AFAICT that's been unnecessary for a good while.
2003-05-05 17:57:47 +00:00
Tom Lane e3ed942e3b Not sure why parser() was still doing clearerr(stdin) ... but it's
*got* to be pointless.
2003-05-05 01:59:02 +00:00
Tom Lane 16503e6fa4 Extended query protocol: parse, bind, execute, describe FE/BE messages.
Only lightly tested as yet, since libpq doesn't know anything about 'em.
2003-05-05 00:44:56 +00:00
Bruce Momjian a59793f82c Disable alternate locations on Win32 because it doesn't support symlinks. 2003-05-04 04:42:52 +00:00
Tom Lane 50ed78b805 Allow 60 in seconds fields of timestamp, time, interval input values.
Per recent discussion on pgsql-general, this is appropriate for spec
compliance, and has the nice side-effect of easing porting from old
pg_dump files that exhibit the 59.999=>60.000 roundoff problem.
2003-05-04 04:30:15 +00:00
Tom Lane ac5fdea687 When a TIMESTAMP, TIME, or INTERVAL precision is specified larger than our
implementation limits, do not issue an ERROR; instead issue a NOTICE and use
the max supported value.  Per pgsql-general discussion of 28-Apr, this is
needed to allow easy porting from pre-7.3 releases where the limits were
higher.

Unrelated change in same area: accept GLOBAL TEMP/TEMPORARY as a synonym
for TEMPORARY, as per pgsql-hackers discussion of 15-Apr.  We previously
rejected it, but that was based on a misreading of the spec --- SQL92's
GLOBAL temp tables are really closer to what we have than their LOCAL ones.
2003-05-04 00:03:55 +00:00
Bruce Momjian 721996d889 Cleanup patch for exec() handling. 2003-05-03 05:13:20 +00:00
Bruce Momjian a7fd03e1de Handle clog structure in shared memory in exec() case, for Win32. 2003-05-03 03:52:07 +00:00
Bruce Momjian 36fa297497 SECOND ATTEMPT
Dump/read non-default GUC values for use by exec'ed backend, for Win32.
2003-05-02 22:02:47 +00:00
Bruce Momjian 9f0d69f527 Back out second part of patch. 2003-05-02 22:01:51 +00:00
Bruce Momjian a2e038fbee Back out last commit --- wrong patch. 2003-05-02 21:59:31 +00:00
Bruce Momjian fb1f7ccec5 Dump/read non-default GUC values for use by exec'ed backends, for Win32. 2003-05-02 21:52:42 +00:00
Tom Lane de28dc9a04 Portal and memory management infrastructure for extended query protocol.
Both plannable queries and utility commands are now always executed
within Portals, which have been revamped so that they can handle the
load (they used to be good only for single SELECT queries).  Restructure
code to push command-completion-tag selection logic out of postgres.c,
so that it won't have to be duplicated between simple and extended queries.
initdb forced due to addition of a field to Query nodes.
2003-05-02 20:54:36 +00:00
Tom Lane 1940434f1e Repair sloppiness about where cached mergeclause pathkeys are allocated.
Without this fix, CVS tip dumps core when running the regression tests
with geqo_threshold = 2.  I would think that a similar patch might be
needed in 7.3, but cannot duplicate the failure in that branch --- so
for now, leave well enough alone.
2003-05-02 19:48:53 +00:00
Tom Lane 0c57d69dd7 Update to describe new set of globally-known contexts planned for support
of extended query features in new FE/BE protocol.  TransactionCommandContext
is gone (PortalContext replaces it for some purposes), and QueryContext
has taken on a new meaning (MessageContext plays its old role).
2003-04-30 19:04:12 +00:00
Tom Lane aa282d4446 Infrastructure for deducing Param types from context, in the same way
that the types of untyped string-literal constants are deduced (ie,
when coerce_type is applied to 'em, that's what the type must be).
Remove the ancient hack of storing the input Param-types array as a
global variable, and put the info into ParseState instead.  This touches
a lot of files because of adjustment of routine parameter lists, but
it's really not a large patch.  Note: PREPARE statement still insists on
exact specification of parameter types, but that could easily be relaxed
now, if we wanted to do so.
2003-04-29 22:13:11 +00:00
Tom Lane 4a5f38c4e6 Code review for holdable-cursors patch. Fix error recovery, memory
context sloppiness, some other things.  Includes Neil's mopup patch
of 22-Apr.
2003-04-29 03:21:30 +00:00
Tom Lane 1045655a25 Prevent coredump in current_schemas() if someone has just deleted a
schema that was in our search path.
2003-04-27 23:22:13 +00:00
Tom Lane 982430f846 Put back encoding-conversion step in processing of incoming queries;
I had inadvertently omitted it while rearranging things to support
length-counted incoming messages.  Also, change the parser's API back
to accepting a 'char *' query string instead of 'StringInfo', as the
latter wasn't buying us anything except overhead.  (I think when I put
it in I had some notion of making the parser API 8-bit-clean, but
seeing that flex depends on null-terminated input, that's not really
ever gonna happen.)
2003-04-27 20:09:44 +00:00
Tom Lane 351372e585 Department of second thoughts: probably still need an IsTransactionState
test in there...
2003-04-27 18:01:46 +00:00
Tom Lane 5f15fa8d06 Clean up some problems in SetClientEncoding: failed to honor doit flag
in all cases, leaked TopMemoryContext memory in others.  Make the
interaction between SetClientEncoding and InitializeClientEncoding
cleaner and better documented.  I suspect these changes should be
back-patched into 7.3, but will wait on Tatsuo's verification.
2003-04-27 17:31:25 +00:00
Tom Lane 3a496c8af0 Repair permissions problem in RI triggers: query parsing has to be done
as the correct user, not only query execution.  Per report from Sean
Chittenden.
2003-04-26 22:21:47 +00:00
Tom Lane 4db9689d1a Add transaction status field to ReadyForQuery messages, and make room
for tableID/columnID in RowDescription.  (The latter isn't really
implemented yet though --- the backend always sends zeroes, and libpq
just throws away the data.)
2003-04-26 20:23:00 +00:00
Tom Lane 2b1e36c7c0 Tweak stats collector start logic so that we will not try to spawn a
new stats collector oftener than once a minute.  Per gripe from Erik Walthinsen
4/25/03.
2003-04-26 02:57:14 +00:00
Tom Lane 9fdb1de3ba Make [VACUUM] ANALYZE safe on zero-column tables. 2003-04-25 21:29:18 +00:00
Tom Lane 9cbaf72177 In the continuing saga of FE/BE protocol revisions, add reporting of
initial values and runtime changes in selected parameters.  This gets
rid of the need for an initial 'select pg_client_encoding()' query in
libpq, bringing us back to one message transmitted in each direction
for a standard connection startup.  To allow server version to be sent
using the same GUC mechanism that handles other parameters, invent the
concept of a never-settable GUC parameter: you can 'show server_version'
but it's not settable by any GUC input source.  Create 'lc_collate' and
'lc_ctype' never-settable parameters so that people can find out these
settings without need for pg_controldata.  (These side ideas were all
discussed some time ago in pgsql-hackers, but not yet implemented.)
2003-04-25 19:45:10 +00:00
Tom Lane 3831636645 const-ify info_cb() to match recent openssl releases. Per Joe Conway. 2003-04-25 04:37:23 +00:00
Tom Lane f779a34c16 Fix breakage induced by yours truly in Kerberos and PAM code. 2003-04-25 03:28:55 +00:00
Tom Lane 6687650ce6 COPY and pg_dump failed to cope with zero-column tables. Fix 'em. 2003-04-25 02:28:22 +00:00
Bruce Momjian db7e46a76d Use closesocket() for all socket/pipe closing, because Win32 requires
it, and map that to close() on Unix.
2003-04-25 01:24:00 +00:00
Tom Lane 5f677af2da Adjust subquery qual pushdown rules so that we can push down a qual
into a UNION that has some type coercions applied to the component
queries, so long as the qual itself does not reference any columns that
have such coercions.  Per example from Jonathan Bartlett 24-Apr-03.
2003-04-24 23:43:09 +00:00
Bruce Momjian 555fe9dda8 Add Win32 Makefile for IPC stuff. 2003-04-24 21:25:34 +00:00
Bruce Momjian 4a10ce5db3 No need for include for Win32 right now. 2003-04-24 21:24:36 +00:00
Bruce Momjian 20ead395c7 Add Win32 shmem/sema prototypes. 2003-04-24 21:23:01 +00:00
Tom Lane f690920a75 Infrastructure for upgraded error reporting mechanism. elog.c is
rewritten and the protocol is changed, but most elog calls are still
elog calls.  Also, we need to contemplate mechanisms for controlling
all this functionality --- eg, how much stuff should appear in the
postmaster log?  And what API should libpq expose for it?
2003-04-24 21:16:45 +00:00
Bruce Momjian a91c5be6a4 pgindent new Win32 files. 2003-04-24 18:14:22 +00:00
Bruce Momjian 1a67e4869c Add shared memory and semaphore routines for Win32.
Also update copyright to be ours, with approval from Jan.
2003-04-24 17:20:23 +00:00
Bruce Momjian d670bf378c Add shared memory and semaphore routines for Win32. 2003-04-24 17:16:13 +00:00
Tom Lane 8a703496a2 getaddrinfo has no business doing unlink(). 2003-04-22 03:52:56 +00:00
Tom Lane 5ed27e35f3 Another round of protocol changes. Backend-to-frontend messages now all
have length words.  COPY OUT reimplemented per new protocol: it doesn't
need \. anymore, thank goodness.  COPY BINARY to/from frontend works,
at least as far as the backend is concerned --- libpq's PQgetline API
is not up to snuff, and will have to be replaced with something that is
null-safe.  libpq uses message length words for performance improvement
(no cycles wasted rescanning long messages), but not yet for error
recovery.
2003-04-22 00:08:07 +00:00
Tom Lane ca944bd2d4 Prevent palloc(0) error when parent table has zero columns. 2003-04-21 15:19:55 +00:00
Tom Lane 1dc3a62ec7 stddev() and variance() should return NULL when there is just one input
value, per recent discussion on pgsql-general.
2003-04-21 00:22:24 +00:00
Tom Lane f9ba0a7fe5 Apple's assembler likes the inlined TAS syntax too, so no reason to
maintain a separate out-of-line version of PPC tas() anymore.
Also fix S_UNLOCK for __powerpc64__ platforms.
2003-04-20 21:54:34 +00:00
Tom Lane b40bc9eac6 Avoid O(N^2) behavior with lots of deferred triggers by making
deferredTriggerInvokeEvents only scan events added since it last ran.
Stephan Szabo, some corrections by Tom Lane.
2003-04-20 17:03:25 +00:00
Bruce Momjian c3b7d2d522 Allow \r and \r\n termination for COPY files.
Output \r\n termination on Win32.

Disallow literal carriage return as a data value,
backslash-carriage-return and \r still allowed.

Doc changes already committed.
2003-04-19 20:36:03 +00:00
Bruce Momjian 9c48cae3e4 Add pipe parameter to COPY function to allow proper line termination. 2003-04-19 19:55:37 +00:00
Tom Lane 3df163ad89 Add more documentation about shared memory costs. 2003-04-19 00:37:28 +00:00
Tom Lane bd8d441775 Second round of FE/BE protocol changes. Frontend->backend messages now
have length counts, and COPY IN data is packetized into messages.
2003-04-19 00:02:30 +00:00
Bruce Momjian 4d4953fc41 Make Win32 tests to match existing Cygwin tests, where appropriate. 2003-04-18 01:03:42 +00:00
Tom Lane cb7fb3ca95 First phase of FE/BE protocol modifications: new StartupPacket layout
with variable-width fields.  No more truncation of long user names.
Also, libpq can now send its environment-variable-driven SET commands
as part of the startup packet, saving round trips to server.
2003-04-17 22:26:02 +00:00
Tom Lane 1426db5d95 Fix stupid oversight ... 2003-04-16 04:37:58 +00:00
Tom Lane 5ab15591d9 eqjoinsel's logic for case where MCV lists are not present should
account for NULLs; in hindsight this is obvious since the code for
the MCV-lists case would reduce to this when there are zero entries
in both lists.  Per example from Alec Mitchell.
2003-04-15 05:18:12 +00:00
Tom Lane 0851e12244 Reorganize clog's error reporting so that PANIC on clog I/O error can
be reduced to a plain ERROR.  Should make it at least a little less
painful to deal with data-corruption problems.
2003-04-14 17:31:33 +00:00
Tom Lane 3fd5faed5b Second try at avoiding conflicts with system isblank(). 2003-04-13 04:07:17 +00:00
Tom Lane ff5456feae Add code to provide useful dynamic-linking error messages on OS X. 2003-04-13 01:19:06 +00:00
Tom Lane ae02cf3c44 Guard against macro versions of isblank(). 2003-04-12 22:28:33 +00:00
Tatsuo Ishii 35a0995992 Fix encoding conversion function bug.
See following posting for more details.

Subject: Re: [HACKERS] [BUGS] Bug #943: Server-Encoding from EUC_TW to UTF-8 doesn't
From: Tatsuo Ishii <t-ishii@sra.co.jp>
To: michael.enke@wincor-nixdorf.com, pgsql-bugs@postgresql.org
Cc: pgsql-hackers@postgresql.org
Date: Sat, 12 Apr 2003 10:51:45 +0900 (JST)
2003-04-12 07:53:57 +00:00
Tom Lane 5674460bb0 Fix error recovery for SSL_read/SSL_write calls. 2003-04-10 23:03:08 +00:00
Tom Lane da2060e5fd Remove premature attempt to constant-fold type coercion expressions.
While usually safe, this fails if the coercion function needs the
query snapshot to be set already.  Per example from Nigel Andrews.
2003-04-10 02:47:46 +00:00
Tom Lane 730840c9b6 First phase of work on array improvements. ARRAY[x,y,z] constructor
expressions, ARRAY(sub-SELECT) expressions, some array functions.
Polymorphic functions using ANYARRAY/ANYELEMENT argument and return
types.  Some regression tests in place, documentation is lacking.
Joe Conway, with some kibitzing from Tom Lane.
2003-04-08 23:20:04 +00:00
Tom Lane 20f8480927 Mark TimeScales constants as double to avoid integer overflow in some compilers. 2003-04-08 17:02:04 +00:00
Tom Lane dbb7503660 Remove extraneous semicolons. 2003-04-08 16:57:45 +00:00
Jan Wieck cd203f3395 Avoid primary key lookup (and lock) if foreign key does not change
on UPDATE.

This get's rid of the long standing annoyance that updating a row
that has foreign keys locks all the referenced rows even if the
foreign key values do not change.

The trick is to actually do a check identical to NO ACTION after an
eventually done UPDATE in the SET DEFAULT case. Since a SET DEFAULT
operation should have moved referencing rows to a new "home", a following
NO ACTION check can only fail if the column defaults of the referencing
table resulted in the key we actually deleted. Thanks to Stephan.

Jan
2003-04-07 20:30:38 +00:00
Tom Lane afe1185cf0 Remove unnecessary dt2local() call. 2003-04-07 15:04:03 +00:00
Peter Eisentraut cb1d036acb Generate pg_config.h.in by autoheader. Separate out manually editable
parts.  Standardize spelling of comments in pg_config.h.
2003-04-06 22:45:23 +00:00
Bruce Momjian 3a8f67d091 Fix compile problem with Win32 macro used inside another macro. 2003-04-05 19:54:12 +00:00
Bruce Momjian d46e643822 Add Win32 path handling for / vs. \ and drive letters. 2003-04-04 20:42:13 +00:00
Bruce Momjian 9bad936f67 Handle cp, rm, and exec for Win32. 2003-04-04 20:40:45 +00:00
Tom Lane d685417fbb Avoid repeated computation of the constants date2j(1970, 1, 1) and
date2j(2000, 1, 1).  Should make for some marginal speed improvement
in date/time operations.
2003-04-04 04:50:44 +00:00
Tom Lane 3b4ca4c0d9 Code review for pg_stat_get_backend_activity_start patch --- fix
return type, make protection condition agree with recent change to
pg_stat_get_backend_activity, clean up documentation.
2003-04-04 03:03:54 +00:00
Tom Lane a385186ff7 Remove zero_damaged_pages from postgresql.conf.sample; the only way to
find out about it is to read the documentation that tells you how
dangerous it is.  Add default_transaction_read_only to documentation;
seems to have been overlooked in patch that added read-only transactions.
Clean up check_guc comparison script, which has been suffering bit rot.
2003-04-03 23:32:47 +00:00
Tom Lane f1fb9e0097 Prevent EXPLAIN (without ANALYZE) SELECT ... INTO from creating an INTO
table.  Needed due to recent change that makes us call ExecutorStart
even when not planning to carry out the query.
2003-04-03 22:35:48 +00:00
Tom Lane 14e6823c7c Don't re-invent the strchr() wheel. 2003-04-03 21:50:23 +00:00
Tom Lane 61c9ea0f3c Fix load_user/load_group to not leave dangling pointers around if the
config files are present on one pass and not present on a later pass.
2003-04-03 21:25:02 +00:00
Tom Lane 906dce0464 Repair incorrect checking of grouped/ungrouped variables in the presence
of unnamed joins; per pghackers discussion 31-Mar-03.
2003-04-03 18:04:09 +00:00
Tom Lane ec54a6efcf Fix buffer overrun in to_ascii(), per report from Guido Notari. 2003-04-02 21:07:59 +00:00
Tom Lane 794162bb1a Fix convSockAddr6to4(): eliminate bogus assumptions about byte ordering,
remove useless SockAddr_ntop() call.  Per report from Andreas Pflug.
2003-04-02 20:00:21 +00:00
Tom Lane d6f1aa9760 Fix platform-dependent failure introduced by recent to_char changes
(ye good olde uninitialized-local-variable).
2003-04-02 02:33:52 +00:00
Tom Lane 1d650da2e5 This is a derived file and should never have been added to CVS. 2003-04-02 00:58:08 +00:00
Tom Lane 1da6eb7fda Whack getaddrinfo() patch around until it works, more or less, on
machines without IPv6.  Or at least it works on HPUX 10.20 ...
2003-04-02 00:49:28 +00:00
Tom Lane f8a15f632d Add missing semicolon. 2003-04-01 23:42:55 +00:00
Bruce Momjian 50be3e5efe The following patch cleans up the deferred trigger mechanism. There is
an unneeded memory context and some variables that are not used anymore.
It's pretty trivial and the regression tests pass fine.  There's no
change in functionality, only deletion of unused code.  I left an empty
function because maybe I'll need it for nested transactions.

Alvaro Herrera
2003-03-31 20:47:51 +00:00
Tom Lane 7cd30e1590 TestConfiguration returns int, not bool. This mistake is relatively
harmless on signed-char machines but would lead to core dump in the
deadlock detection code if char is unsigned.  Amazingly, this bug has
been here since 7.1 and yet wasn't reported till now.  Thanks to Robert
Bruccoleri for providing the opportunity to track it down.
2003-03-31 20:32:29 +00:00
Bruce Momjian 5e1c330227 Properly document default value of log_min_error_statement in postgresql.conf. 2003-03-30 21:38:02 +00:00
Peter Eisentraut 82a91eb54e Simplify the socket handling code by supplying a replacement getaddrinfo()
function if the OS doesn't provide one.
2003-03-29 11:31:52 +00:00
Bruce Momjian bf7ca0a769 [ Backpatch to 7.3.X.]
SSL_read/write can error needing ERROR_WANT_READ or ERROR_WANT_WRITE.
2003-03-29 05:00:15 +00:00
Bruce Momjian 0184db50a0 [ Backpatch to 7.3.X.]
typing error in src/backend/libpq/be-secure.c ???

Long Description
In src/backend/libpq/be-secure.c: secure_write
on SSL_ERROR_WANT_WRITE call secure_read instead
secure_write again. May be is this a typing error?

Sergey N. Yatskevich (syatskevich@n21lab.gosniias.msk.ru)
2003-03-29 03:56:44 +00:00
Tom Lane fd42262836 Add code to apply some simple sanity checks to the header fields of a
page when it's read in, per pghackers discussion around 17-Feb.  Add a
GUC variable zero_damaged_pages that causes the response to be a WARNING
followed by zeroing the page, rather than the normal ERROR; this is per
Hiroshi's suggestion that there needs to be a way to get at the data
in the rest of the table.
2003-03-28 20:17:13 +00:00
Tom Lane 1bd159e4e9 Fix bogus coding of SET DEFAULT ri triggers ... or at least make it less
bogus than it was.  Per bug report from Adrian Pop.
2003-03-27 19:25:40 +00:00
Bruce Momjian 6f2d02d306 Fix syntax error in to_char fixes --- was defining variable in main code
block, ala C++.
2003-03-27 17:10:55 +00:00
Bruce Momjian 4b0b8dadd2 Add new files. 2003-03-27 16:53:15 +00:00
Bruce Momjian 54f7338fa1 This patch implements holdable cursors, following the proposal
(materialization into a tuple store) discussed on pgsql-hackers earlier.
I've updated the documentation and the regression tests.

Notes on the implementation:

- I needed to change the tuple store API slightly -- it assumes that it
won't be used to hold data across transaction boundaries, so the temp
files that it uses for on-disk storage are automatically reclaimed at
end-of-transaction. I added a flag to tuplestore_begin_heap() to control
this behavior. Is changing the tuple store API in this fashion OK?

- in order to store executor results in a tuple store, I added a new
CommandDest. This works well for the most part, with one exception: the
current DestFunction API doesn't provide enough information to allow the
Executor to store results into an arbitrary tuple store (where the
particular tuple store to use is chosen by the call site of
ExecutorRun). To workaround this, I've temporarily hacked up a solution
that works, but is not ideal: since the receiveTuple DestFunction is
passed the portal name, we can use that to lookup the Portal data
structure for the cursor and then use that to get at the tuple store the
Portal is using. This unnecessarily ties the Portal code with the
tupleReceiver code, but it works...

The proper fix for this is probably to change the DestFunction API --
Tom suggested passing the full QueryDesc to the receiveTuple function.
In that case, callers of ExecutorRun could "subclass" QueryDesc to add
any additional fields that their particular CommandDest needed to get
access to. This approach would work, but I'd like to think about it for
a little bit longer before deciding which route to go. In the mean time,
the code works fine, so I don't think a fix is urgent.

- (semi-related) I added a NO SCROLL keyword to DECLARE CURSOR, and
adjusted the behavior of SCROLL in accordance with the discussion on
-hackers.

- (unrelated) Cleaned up some SGML markup in sql.sgml, copy.sgml

Neil Conway
2003-03-27 16:51:29 +00:00
Bruce Momjian 7a3e7b64ac to_char fixes, Karel Zak 2003-03-27 16:35:31 +00:00
Tom Lane bf576cc014 GetTupleForTrigger must use outer transaction's command counter for time
qual checking, not GetCurrentCommandId.  Per test case from Steve Wolfe.
2003-03-27 14:33:11 +00:00
Peter Eisentraut 5e5c5cd31a Merge documentation into one book. (Build with "make html".) Replace
vague cross-references with real links.
2003-03-25 16:15:44 +00:00
Tom Lane 6ba159f9cf Ignore SIGXFSZ (if platform has it), so that ulimit violations work like
disk-full conditions instead of provoking a backend crash.  Per suggestion
from Frederic Surleau.
2003-03-24 22:40:14 +00:00
Tom Lane fddc2d94ce Modify keys_are_unique optimization to release buffer pins before it
returns NULL.  This avoids out-of-buffers failures during many-way
indexscans, as in Shraibman's complaint of 21-Mar.
2003-03-24 21:42:33 +00:00
Bruce Momjian 346182ca92 Add comment to postgresql.conf:
#search_path = '$user,public'   # schema names
2003-03-24 20:39:10 +00:00
Bruce Momjian 8670e3588f Prevent multiple queries in a single string into a single transaction
when autocommit is off, and document grouping when autocommit is on.
2003-03-24 18:33:52 +00:00
Tom Lane 0489783011 Adjust amrescan code so that it's allowed to call index_rescan with a
NULL key pointer, indicating that the existing scan key should be reused.
This behavior isn't used yet but will be needed for my planned fix to
the keys_are_unique code.
2003-03-23 23:01:03 +00:00
Tom Lane 8d9e025e7f Instead of storing pg_statistic stavalues entries as text strings, store
them as arrays of the internal datatype.  This requires treating the
stavalues columns as 'anyarray' rather than 'text[]', which is not 100%
kosher but seems to work fine for the purposes we need for pg_statistic.
Perhaps in the future 'anyarray' will be allowed more generally.
2003-03-23 05:14:37 +00:00
Tom Lane efeffae245 Tweak selectivity and related routines to cope with domains. Per report
from Andreas Pflug.
2003-03-23 01:49:02 +00:00
Tom Lane 9323cb0aab Department of second thoughts: probably shouldn't use nth() to get the
appropriate targetlist entry out of the subquery.  Use an explicit search
like we do everywhere else.
2003-03-22 17:11:25 +00:00
Bruce Momjian ed11ccf4d4 Fix comment-only query to return Null result set, rather than nothing.
Cleans up blank query handling to be more consistent.
2003-03-22 04:23:34 +00:00
Bruce Momjian aaf11b931f Back out to_char fixes until regression tests are fixed. 2003-03-22 02:12:24 +00:00
Tom Lane 05f916e6ad Adjust subquery qual pushdown rules to be more forgiving: if a qual
refers to a non-DISTINCT output column of a DISTINCT ON subquery, or
if it refers to a function-returning-set, we cannot push it down.
But the old implementation refused to push down *any* quals if the
subquery had any such 'dangerous' outputs.  Now we just look at the
output columns actually referenced by each qual expression.  More code
than before, but probably no slower since we don't make unnecessary checks.
2003-03-22 01:49:38 +00:00