Commit Graph

215 Commits

Author SHA1 Message Date
Bruce Momjian 7acc237744 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.

Hope this makes the grade,

Mike Mascari
(mascarim@yahoo.com)
1999-10-15 01:49:49 +00:00
Tom Lane 3eb1c82277 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.
1999-10-07 04:23:24 +00:00
Bruce Momjian 00c85b44b8 Allow comment-only lines, and ;;; lines too. 1999-10-05 18:14:31 +00:00
Tom Lane eabc714a91 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.
1999-10-03 23:55:40 +00:00
Tom Lane 6eb8d255d2 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).
1999-10-02 21:33:33 +00:00
Jan Wieck 1547ee017c This is part #1 for of the DEFERRED CONSTRAINT TRIGGER support.
Implements the CREATE CONSTRAINT TRIGGER and SET CONSTRAINTS commands.

TODO:
    Generic builtin trigger procedures
    Automatic execution of appropriate CREATE CONSTRAINT... at CREATE TABLE
    Support of new trigger type in pg_dump
    Swapping of huge # of events to disk

Jan
1999-09-29 16:06:40 +00:00
Bruce Momjian 8ccebab8bd More cleanup for | and ^. 1999-09-28 14:49:36 +00:00
Bruce Momjian 77bef41c7f More cleanup for | and ^. 1999-09-28 14:38:02 +00:00
Bruce Momjian f44c7bad6c Fix for creation of operator |. 1999-09-28 14:31:19 +00:00
Bruce Momjian 9394d62c73 I have been working with user defined types and user defined c
functions.  One problem that I have encountered with the function
manager is that it does not allow the user to define type conversion
functions that convert between user types. For instance if mytype1,
mytype2, and mytype3 are three Postgresql user types, and if I wish to
define Postgresql conversion functions like

I run into problems, because the Postgresql dynamic loader would look
for a single link symbol, mytype3, for both pieces of object code.  If
I just change the name of one of the Postgresql functions (to make the
symbols distinct), the automatic type conversion that Postgresql uses,
for example, when matching operators to arguments no longer finds the
type conversion function.

The solution that I propose, and have implemented in the attatched
patch extends the CREATE FUNCTION syntax as follows. In the first case
above I use the link symbol mytype2_to_mytype3 for the link object
that implements the first conversion function, and define the
Postgresql operator with the following syntax

The patch includes changes to the parser to include the altered
syntax, changes to the ProcedureStmt node in nodes/parsenodes.h,
changes to commands/define.c to handle the extra information in the AS
clause, and changes to utils/fmgr/dfmgr.c that alter the way that the
dynamic loader figures out what link symbol to use.  I store the
string for the link symbol in the prosrc text attribute of the pg_proc
table which is currently unused in rows that reference dynamically
loaded
functions.


Bernie Frankpitt
1999-09-28 04:34:56 +00:00
Bruce Momjian e7cad7b0cb Add TRUNCATE command, with psql help and sgml additions. 1999-09-23 17:03:39 +00:00
Thomas G. Lockhart 2ee735ca21 Allow ISOLATION and LEVEL as column names. These are SQL92 reserved words
which do not need to be so for our parser. Apparently omitted earlier.
1999-09-14 06:06:31 +00:00
Tatsuo Ishii 02efaa14e5 Old multi-byte bug. Forgot to rename #ifdef MB to #ifdef MULTIBYTE
Now SET NAMES working again...
1999-08-18 13:04:45 +00:00
Tom Lane 9682e8081b Allow a_expr not just AexprConst in the right-hand list of
IN and NOT IN operators.  Rewrite grotty implementation of IN-list
parsing ... look Ma, no global variable ...
1999-07-28 17:39:38 +00:00
Tom Lane 9e7e29e6c9 First cut at doing LIKE/regex indexing optimization in
optimizer rather than parser.  This has many advantages, such as not
getting fooled by chance uses of operator names ~ and ~~ (the operators
are identified by OID now), and not creating useless comparison operations
in contexts where the comparisons will not actually be used as indexquals.
The new code also recognizes exact-match LIKE and regex patterns, and
produces an = indexqual instead of >= and <=.

This change does NOT fix the problem with non-ASCII locales: the code
still doesn't know how to generate an upper bound indexqual for non-ASCII
collation order.  But it's no worse than before, just the same deficiency
in a different place...

Also, dike out loc_restrictinfo fields in Plan nodes.  These were doing
nothing useful in the absence of 'expensive functions' optimization,
and they took a considerable amount of processing to fill in.
1999-07-27 03:51:11 +00:00
Tom Lane 2908bd535f Complain about INSERT ... SELECT ... ORDER BY, which we do not
support, but which the grammar was accepting.  Also, fix several bugs
having to do with failure to copy fields up from a subselect to a select
or insert node.
1999-07-20 00:18:01 +00:00
Bruce Momjian 3406901a29 Move some system includes into c.h, and remove duplicates. 1999-07-17 20:18:55 +00:00
Tom Lane f9e2c7fae8 Allow bare column names to be subscripted as arrays. This
creates a reduce/reduce conflict, which I resolved by changing the
'AexprConst -> Typename Sconst' rule to 'AexprConst -> SimpleTypename Sconst'.
In other words, a subscripted type declaration can't be used in that
syntax any longer.  This seems a small price to pay for not having to
qualify subscripted columns anymore.
Other cleanups: rename res_target_list to update_target_list, and remove
productions for variants that are not legal in an UPDATE target list;
rename res_target_list2 to plain target_list; delete position_expr
in favor of using b_expr in that production; merge opt_indirection
into attr nonterminal, since there are no places where an unsubscripted
attr is wanted; fix typos in Param support; change case_arg so that
an arbitrary a_expr is allowed, not only a column name.
1999-07-16 22:29:42 +00:00
Bruce Momjian a71802e12e Final cleanup. 1999-07-16 05:00:38 +00:00
Bruce Momjian 4b2c2850bf Clean up #include in /include directory. Add scripts for checking includes. 1999-07-15 15:21:54 +00:00
Bruce Momjian ad4948862c Remove S*I comments from Stephan. 1999-07-13 21:17:45 +00:00
Bruce Momjian 863db45e86 Make ^ precidence greater than *. 1999-07-09 21:59:59 +00:00
Bruce Momjian 104d6c816e Add ^ precidence. 1999-07-08 00:00:43 +00:00
Bruce Momjian eba41848aa Clarify maximum tuple and max attribute lengths. 1999-07-04 04:56:02 +00:00
Bruce Momjian 97dfff832c Fix to prevent too large tuple from being created. 1999-07-03 00:33:04 +00:00
Tom Lane bad3b3068d Repair recently-introduced error in makeIndexable for LIKE:
a non-leading % would be put into the >=/<= patterns.  Also, repair
longstanding confusion about whether %% means a literal %%.  The SQL92
doesn't say any such thing, and textlike() knows that, but gram.y didn't.
1999-06-07 14:28:26 +00:00
Bruce Momjian e9edb3ef92 Fix for select 1;select 2 without trailing semi. 1999-05-22 05:06:43 +00:00
Bruce Momjian c0d979614e Fix typo and attempt default fix. 1999-05-21 18:31:06 +00:00
Bruce Momjian 96492290b5 Treat {} as special regex too. 1999-05-21 15:47:13 +00:00
Bruce Momjian 56b9a549c7 Fix problem with | in ~ comparison using index. 1999-05-21 04:40:04 +00:00
Jan Wieck 443c08a110 Fixed shift/reduce conflict
SelectStmt and CursorStmt tried to parse FOR UPDATE ... / FOR READ ONLY.
Cursor now checks that it is read only by looking at forUpdate of Query.
SelectStmt handles FOR READ ONLY too.

Jan
1999-05-20 12:12:55 +00:00
Bruce Momjian 6d08b6a7b8 Remove 4096 string limited key on block size 1999-05-19 17:53:12 +00:00
Bruce Momjian 61f618e73e Move IN to proper place. 1999-05-17 01:01:06 +00:00
Bruce Momjian a341db91c5 Cleanup 1999-05-17 00:31:49 +00:00
Bruce Momjian c686be8d56 Require IN in LOCK syntax. 1999-05-17 00:22:07 +00:00
Thomas G. Lockhart bcb5aac81d Add keywords to implement Vadim's transaction isolation
and lock syntax as fully parsed tokens.
Two keywords for isolation are non-reserved SQL92
 (COMMITTED, SERIALIZABLE).
All other new keywords are non-reserved Postgres (not SQL92)
 (ACCESS, EXCLUSIVE, MODE, SHARE).
Add syntax to allow CREATE [GLOBAL|LOCAL] TEMPORARY TABLE, throwing an
 error if GLOBAL is specified.
1999-05-12 07:22:52 +00:00
Bruce Momjian 12f9de3fd4 clean up comments 1999-05-11 03:28:43 +00:00
Bruce Momjian 210055ad61 here are some patches for 6.5.0 which I already submitted but have never
been applied. The patches are in the .tar.gz attachment at the end:

varchar-array.patch     this patch adds support for arrays of bpchar() and
                        varchar(), which where always missing from postgres.

                        These datatypes can be used to replace the _char4,
                        _char8, etc., which were dropped some time ago.

block-size.patch        this patch fixes many errors in the parser and other
                        program which happen with very large query statements
                        (> 8K) when using a page size larger than 8192.

                        This patch is needed if you want to submit queries
                        larger than 8K. Postgres supports tuples up to 32K
                        but you can't insert them because you can't submit
                        queries larger than 8K. My patch fixes this problem.

                        The patch also replaces all the occurrences of `8192'
                        and `1<<13' in the sources with the proper constants
                        defined in include files. You should now never find
                        8192 hardwired in C code, just to make code clearer.


--
Massimo Dal Zotto
1999-05-03 19:10:48 +00:00
Jan Wieck 26909a0797 Fixed DECIMAL data type to handle specified precision in atttypmod
Jan
1999-04-27 13:33:43 +00:00
Bruce Momjian 6eccfbc727 Add temporary for temp. 1999-04-19 16:00:18 +00:00
Bruce Momjian 9aa535a2b9 Add % to b_expr. 1999-03-22 05:07:32 +00:00
Bruce Momjian f8263c52b0 cleanup 1999-03-21 02:30:22 +00:00
Bruce Momjian 7ed3b89d48 Fix for %4 and 4%. 1999-03-21 02:26:56 +00:00
Bruce Momjian 5bfac23006 Fix shift/reduce for NULL = Var. 1999-03-19 23:48:50 +00:00
Bruce Momjian 5dd9b58a86 grammar cleanup' 1999-03-18 22:03:59 +00:00
Bruce Momjian ddd50c440a cleanup of grammer. 1999-03-18 22:01:56 +00:00
Bruce Momjian 30ad427388 Fix optimizer indexing not working for negative numbers. 1999-03-18 21:39:56 +00:00
Bruce Momjian 4989feaf3d Left associates all operators, instead of non-associating them. 1999-03-17 21:02:57 +00:00
Bruce Momjian 3b43accb0f Have % operator have precedence like /. 1999-03-17 20:17:13 +00:00
Bruce Momjian 3a03e3cd30 cleanup 1999-03-15 22:20:20 +00:00