Implement the IS DISTINCT FROM operator per SQL99.
Reused the Expr node to hold DISTINCT which strongly resembles
the existing OP info. Define DISTINCT_EXPR which strongly resembles
the existing OPER_EXPR opType, but with handling for NULLs required
by SQL99.
We have explicit support for single-element DISTINCT comparisons
all the way through to the executor. But, multi-element DISTINCTs
are handled by expanding into a comparison tree in gram.y as is done for
other row comparisons. Per discussions, it might be desirable to move
this into one or more purpose-built nodes to be handled in the backend.
Define the optional ROW keyword and token per SQL99.
This allows single-element row constructs, which were formerly disallowed
due to shift/reduce conflicts with parenthesized a_expr clauses.
Define the SQL99 TREAT() function. Currently, use as a synonym for CAST().
Bruce Momjian [Thu, 4 Jul 2002 03:04:55 +0000 (03:04 +0000)]
Document function args are required for pg_restore -P.
Fix pg_dump to not quote the function name in the storage tag.
Fix pg_dump so GRANT/REVOKE(ACL) tag entries are not quoted, for
consistency.
Fix pg_restore to properly handle quotes and some spaces in -P.
Tom Lane [Wed, 3 Jul 2002 16:47:46 +0000 (16:47 +0000)]
Fix some more boundary-case errors in psql variable substitution:
wasn't really right for case where :var is at the end of the line,
was definitely not right if var expanded to empty in that case,
and failed to recalculate thislen before jumping back to rescan.
Bruce Momjian [Tue, 2 Jul 2002 06:18:57 +0000 (06:18 +0000)]
>the extra level of struct naming for pd_opaque has no obvious
>usefulness.
>
>> [...] should I post a patch that puts pagesize directly into
>> PageHeaderData?
>
>If you're so inclined. Given that pd_opaque is hidden in those macros,
>there wouldn't be much of any gain in readability either, so I haven't
>worried about changing the declaration.
Thanks for the clarification. Here is the patch. Not much gain, but at
least it saves the next junior hacker from scratching his head ...
Bruce Momjian [Tue, 2 Jul 2002 05:48:44 +0000 (05:48 +0000)]
There already was a macro PageGetItemId; this is now used in (almost)
all places, where pd_linp is accessed. Also introduce new macros
SizeOfPageHeaderData and BTMaxItemSize. This is just source code
cosmetic, no behaviour changed.
Bruce Momjian [Tue, 2 Jul 2002 05:47:37 +0000 (05:47 +0000)]
Minor code cleanup in bufmgr.c and bufmgr.h, mainly by moving repeated
lines of code into internal routines (drop_relfilenode_buffers,
release_buffer) and by hiding unused routines (PrintBufferDescs,
PrintPinnedBufs) behind #ifdef NOT_USED. Remove AbortBufferIO()
declaration from bufmgr.c (already declared in bufmgr.h)
Bruce Momjian [Tue, 2 Jul 2002 05:46:14 +0000 (05:46 +0000)]
This patch, which is built upon the "HeapTupleHeader accessor macros"
patch from 2002-06-10, is supposed to reduce the heap tuple header size
by four bytes on most architectures. Of course it changes the on-disk
tuple format and therefore requires initdb.
This overlays cmin/cmax/xmax fields into only two fields.
Tom Lane [Mon, 1 Jul 2002 15:27:56 +0000 (15:27 +0000)]
First phase of applying Rod Taylor's pg_depend patch. This just adds
RESTRICT/CASCADE syntax to the DROP commands that need it, and propagates
the behavioral option through the parser to the routines that execute
drops. Doesn't do anything useful yet, but I figured I'd commit these
changes so I could get out of the parser area while working on the rest.
Michael Meskes [Sun, 30 Jun 2002 09:34:14 +0000 (09:34 +0000)]
Committing parser changes. Note, however, that the development bison seems ot have a problem on my home machine. So these go in untested for the time being. But at least I have them in the archive.
Bruce Momjian [Wed, 26 Jun 2002 21:58:56 +0000 (21:58 +0000)]
The attached patch fixes some spelling mistakes, makes the
comments on one of the optimizer functions a lot more
clear, adds a summary of the recent KSQO discussion to the
comments in the code, adds regression tests for the bug with
sequence state Tom fixed recently and another reg. test, and
removes some PostQuel legacy stuff: ExecAppend -> ExecInsert,
ExecRetrieve -> ExecSelect, etc.
Bruce Momjian [Tue, 25 Jun 2002 17:27:20 +0000 (17:27 +0000)]
The attached patch fixes some spelling mistakes, makes the
comments on one of the optimizer functions a lot more
clear, adds a summary of the recent KSQO discussion to the
comments in the code, adds regression tests for the bug with
sequence state Tom fixed recently and another reg. test, and
removes some PostQuel legacy stuff: ExecAppend -> ExecInsert,
ExecRetrieve -> ExecSelect, etc. This was changed because the
elog() messages from this routine are user-visible, so we
should be using the SQL terms.
Barry Lind [Mon, 24 Jun 2002 04:53:05 +0000 (04:53 +0000)]
fixed bug reported by Wolfgang Winter w.winter@logitags.com where historic timestamps which do not have timezone info were being interpreted in local timezone instead of GMT. Also added a check to support timestamp vs. timestamptz in this code
Bruce Momjian [Sun, 23 Jun 2002 21:29:32 +0000 (21:29 +0000)]
It seems that ExecInit/EndIndexScan is leaking some memory...
For example, if I run a query, that uses an index scan, and call
MemoryContextSt ats (CurrentMemoryContext) before ExecutorStart() and
after ExecutorEnd() in ProcessQuery(), I am consistently see ing that
the 'after' call shows 256 bytes more used, then 'before'...
The problem seems to be in ExecEndIndexScan - it does not release
scanstate, ind exstate, indexstate->iss_RelationDescs and indexstate ->
iss_ScanDescs...
Bruce Momjian [Sun, 23 Jun 2002 20:09:23 +0000 (20:09 +0000)]
Update dbsize documentation with:
Copy this directory to contrib/dbsize in your PostgreSQL source tree.
Then just run make; make install. Finally, load the functions into any
database using dbsize.sql.
When computing the size of a table, it does not include TOAST or index
disk space.
Implement SQL99 CREATE CAST and DROP CAST statements.
Also implement alternative forms to expose the PostgreSQL CREATE FUNCTION
features.
Implement syntax for READ ONLY and READ WRITE clauses in SET TRANSACTION.
READ WRITE is already implemented (of course).
Implement syntax for "LIKE table" clause in CREATE TABLE. Should be fairly
easy to complete since it resembles SELECT INTO.
Implement MATCH SIMPLE clause for foreign key definitions. This is explicit
SQL99 syntax for the default behavior, so we now support it :)
Start implementation of shorthand for national character literals in
scanner. For now, just swallow the leading "N", but sometime soon let's
figure out how to pass leading type info from the scanner to the parser.
We should use the same technique for binary and hex bit string literals,
though it might be unusual to have two apparently independent literal
types fold into the same storage type.
Bruce Momjian [Thu, 20 Jun 2002 17:19:08 +0000 (17:19 +0000)]
Here is a patch for Composite and Set returning function support. I made
two small changes to the API since last patch, which hopefully completes
the decoupling of composite function support from SRF specific support.
Bruce Momjian [Thu, 20 Jun 2002 17:09:42 +0000 (17:09 +0000)]
Attached is a regression test patch for SRFs. I based it on the test
scripts that I have been using, minus the C function tests and without
calls to random() -- figured random() wouldn't work too well for a
regression test ;-)
Bruce Momjian [Thu, 20 Jun 2002 16:57:00 +0000 (16:57 +0000)]
> Here's the first doc patch for SRFs. The patch covers general
> information and SQL language specific info wrt SRFs. I've taken to
> calling this feature "Table Fuctions" to be consistent with (at least)
> one well known RDBMS.
Bruce Momjian [Tue, 18 Jun 2002 17:27:58 +0000 (17:27 +0000)]
Change CREATE DATABASE to use DefElem instead of constructing structure
members in gram.y. This is the prefered method for WITH and arbitrary
param/value pairs.