Bruce Momjian [Fri, 15 Oct 1999 01:49:49 +0000 (01:49 +0000)]
This patch implements ORACLE's COMMENT SQL command.
>From the ORACLE 7 SQL Language Reference Manual:
-----------------------------------------------------
COMMENT
Purpose:
To add a comment about a table, view, snapshot, or
column into the data dictionary.
Prerequisites:
The table, view, or snapshot must be in your own
schema
or you must have COMMENT ANY TABLE system privilege.
Syntax:
COMMENT ON [ TABLE table ] |
[ COLUMN table.column] IS 'text'
You can effectively drop a comment from the database
by setting it to the empty string ''.
-----------------------------------------------------
Example:
COMMENT ON TABLE workorders IS
'Maintains base records for workorder information';
COMMENT ON COLUMN workorders.hours IS
'Number of hours the engineer worked on the task';
to drop a comment:
COMMENT ON COLUMN workorders.hours IS '';
The current patch will simply perform the insert into
pg_description, as per the TODO. And, of course, when
the table is dropped, any comments relating to it
or any of its attributes are also dropped. I haven't
looked at the ODBC source yet, but I do know from
an ODBC client standpoint that the standard does
support the notion of table and column comments.
Hopefully the ODBC driver is already fetching these
values from pg_description, but if not, it should be
trivial.
Tom Lane [Wed, 13 Oct 1999 15:02:32 +0000 (15:02 +0000)]
Split 'BufFile' routines out of fd.c into a new module, buffile.c. Extend
BufFile so that it handles multi-segment temporary files transparently.
This allows sorts and hashes to work with data exceeding 2Gig (or whatever
the local limit on file size is). Change psort.c to use relative seeks
instead of absolute seeks for backwards scanning, so that it won't fail
when the data volume exceeds 2Gig.
Bruce Momjian [Wed, 13 Oct 1999 02:26:37 +0000 (02:26 +0000)]
BLOBs containing NUL characters (ASCII 0) can be written to the
database, but they get truncated at the first NUL by lo_read
when they are read back. The reason for this is that lo_read in
Pg.xs is using the default:
OUTPUT:
RETVAL
buf
which uses C's strlen() to work out the length of the scalar.
The code ought to read something more like:
OUTPUT:
RETVAL
buf sv_setpvn((SV*)ST(2), buf, RETVAL);
I am not sure if this needs to be done on both lo_read methods
in this file, but I changed both and have not since had any
problems with truncated BLOBs.
Bruce Momjian [Tue, 12 Oct 1999 14:54:28 +0000 (14:54 +0000)]
I have created a small patch that makes possible to compile pgsql on newer
Cygwin snapshots (tested on 990115 which is recommended to use - it fixes
some errors in B20.1)
And I have another patch for including <sys/ipc.h> before <sys/sem.h> in
backend/storage/lmgr/proc.c - it is required due the design of cygipc
headers
Add DEC and SESSION_USER as reserved words.
Move around a few other keywords which were not in the right category.
DEC and SESSION_USER are not yet committed to gram.y,
since I'm in the middle of working on JOIN syntax too.
Bruce Momjian [Fri, 8 Oct 1999 04:28:57 +0000 (04:28 +0000)]
Cleanup -is flag to -l for SSL. Another PERL variable name fix. Clean
up debugging options for postmaster and postgres programs. postmaster
-d is no longer optional. Documentation updates.
Tom Lane [Thu, 7 Oct 1999 04:23:24 +0000 (04:23 +0000)]
Fix planner and rewriter to follow SQL semantics for tables that are
mentioned in FROM but not elsewhere in the query: such tables should be
joined over anyway. Aside from being more standards-compliant, this allows
removal of some very ugly hacks for COUNT(*) processing. Also, allow
HAVING clause without aggregate functions, since SQL does. Clean up
CREATE RULE statement-list syntax the same way Bruce just fixed the
main stmtmulti production.
CAUTION: addition of a field to RangeTblEntry nodes breaks stored rules;
you will have to initdb if you have any rules.
XLOG (also known as WAL -:)) Bootstrap/Startup/Shutdown.
First step in cleaning up backend initialization code.
Fix for FATAL: now FATAL is ERROR + exit.
Hiroshi Inoue [Wed, 6 Oct 1999 06:38:04 +0000 (06:38 +0000)]
Improve the treatment of partial(incomplete) blocks of relation files.
This may solve a TODO item
* Recover or force failure when disk space is exhausted
Bruce Momjian [Wed, 6 Oct 1999 03:00:16 +0000 (03:00 +0000)]
CmdTuples() returns an int showing the number of affected tuples after an
insert, update or delete. It will return -1 on error, although I've yet
to an error situation to prove that out!
Tom Lane [Mon, 4 Oct 1999 02:12:26 +0000 (02:12 +0000)]
Oops, DEFAULT processing wasn't doing type compatibility checking
quite the same way that transformInsertStatement does, so that an expression
could be accepted by CREATE TABLE and then fail when used. Also, put back
check that CONSTRAINT expressions must yield boolean...
Tom Lane [Sun, 3 Oct 1999 23:55:40 +0000 (23:55 +0000)]
Reimplement parsing and storage of default expressions and constraint
expressions in CREATE TABLE. There is no longer an emasculated expression
syntax for these things; it's full a_expr for constraints, and b_expr
for defaults (unfortunately the fact that NOT NULL is a part of the
column constraint syntax causes a shift/reduce conflict if you try a_expr.
Oh well --- at least parenthesized boolean expressions work now). Also,
stored expression for a column default is not pre-coerced to the column
type; we rely on transformInsertStatement to do that when the default is
actually used. This means "f1 datetime default 'now'" behaves the way
people usually expect it to.
BTW, all the support code is now there to implement ALTER TABLE ADD
CONSTRAINT and ALTER TABLE ADD COLUMN with a default value. I didn't
actually teach ALTER TABLE to call it, but it wouldn't be much work.
Bruce Momjian [Sun, 3 Oct 1999 18:05:04 +0000 (18:05 +0000)]
I hope this is what you had in mind:
--enable-debug adds -g (unconditionally)
--disable-debug removes -g (if it was already in there somehow)
(giving neither does nothing)
Since none of the templates default CFLAGS with a -g you're not likely
to
end up with two -g flags. Not that they'd hurt though.
Tom Lane [Sat, 2 Oct 1999 21:33:33 +0000 (21:33 +0000)]
Allow CREATE FUNCTION's WITH clause to be used for all language types,
not just C, so that ISCACHABLE attribute can be specified for user-defined
functions. Get rid of ParamString node type, which wasn't actually being
generated by gram.y anymore, even though define.c thought that was what
it was getting. Clean up minor bug in dfmgr.c (premature heap_close).
Tom Lane [Sat, 2 Oct 1999 04:42:04 +0000 (04:42 +0000)]
Stick finger into a couple more holes in the leaky dike of
modifyAggrefQual. This routine really, really needs to be retired, but
until we have subselects in FROM there's no chance of doing the job right.
In the meantime try to respond to unhandlable cases with elog rather than
coredump.
Tom Lane [Sat, 2 Oct 1999 04:37:52 +0000 (04:37 +0000)]
Fix make_clause and make_opclause to record valid type info
in the Expr nodes they produce. This fixes a few cases of errors like
'typeidTypeRelid: Invalid type - oid = 0' caused by calling parser-related
routines on expression trees that have already been processed by planner-
related routines.
Tom Lane [Sat, 2 Oct 1999 01:08:05 +0000 (01:08 +0000)]
Revise rule-printing routines to use expandable StringInfo buffers, so that
they have no hardwired limit on the length of a rule's text. Fix a couple
of minor bugs in passing --- deparsed UPDATE queries didn't have quotes
around relation name, and quotes and backslashes in constant values weren't
backslash-quoted.
Make TABLE an optional keyword, a la LOCK TABLE (gram.y fixes not yet
committed, but will be within a week or two).
Actually include the reference page into the docs...
Tom Lane [Fri, 1 Oct 1999 04:08:24 +0000 (04:08 +0000)]
Clean up rewriter routines to use expression_tree_walker and
expression_tree_mutator rather than ad-hoc tree walking code. This shortens
the code materially and fixes a fair number of sins of omission. Also,
change modifyAggrefQual to *not* recurse into subselects, since its mission
is satisfied if it removes aggregate functions from the top level of a
WHERE clause. This cures problems with queries of the form SELECT ...
WHERE x IN (SELECT ... HAVING something-using-an-aggregate), which would
formerly get mucked up by modifyAggrefQual. The routine is still
fundamentally broken, of course, but I don't think there's any way to get
rid of it before we implement subselects in FROM ...
Tom Lane [Thu, 30 Sep 1999 02:45:17 +0000 (02:45 +0000)]
Reverse out getopt patch --- turns out it doesn't help on my
platform, and there are at least some people it's not broken for. So undo
change until we can discuss a more portable solution.