Commit Graph

431 Commits

Author SHA1 Message Date
Bruce Momjian 10f05d8127 Merge ALTER GROUP ADD/DROP rules by creating add_drop action. 2002-06-17 07:00:27 +00:00
Bruce Momjian f91ee129a7 Simplify optional WITH handling in CREATE USER, ALTER USER, CREATE
GROUP.  Make WITH optional in CREATE DATABASE for consistency.
2002-06-17 05:40:32 +00:00
Thomas G. Lockhart 133df7ce70 Add LOCALTIME and LOCALTIMESTAMP functions per SQL99 standard.
Remove ODBC-compatible empty parentheses from calls to SQL99 functions
 for which these parentheses do not match the standard.
Update the ODBC driver to ensure compatibility with the ODBC standard
 for these functions (e.g. CURRENT_TIMESTAMP, CURRENT_USER, etc).
Include a new appendix in the User's Guide which lists the labeled features
 for SQL99 (the labeled features replaced the "basic", "intermediate",
 and "advanced" categories from SQL92). features.sgml does not yet split
 this list into "supported" and "unsupported" lists.
2002-06-15 03:00:09 +00:00
Thomas G. Lockhart bbc9b759d6 Add PLACING to the list of reserved keywords. Added as a token in the last
update to support the new OVERLAY() function.
2002-06-13 14:16:43 +00:00
Thomas G. Lockhart ea01a451cc Implement SQL99 OVERLAY(). Allows substitution of a substring in a string.
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~".
Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape).
 Extend the definition to make the FOR clause optional.
 Define textregexsubstr() to actually implement this feature.
Update the regression test to include these new string features.
 All tests pass.
Rename the regular expression support routines from "pg95_xxx" to "pg_xxx".
Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
2002-06-11 15:44:38 +00:00
Jan Wieck 469cb65aca Katherine Ward wrote:
> Changes to avoid collisions with WIN32 & MFC names...
> 1.  Renamed:
>       a.  PROC => PGPROC
>       b.  GetUserName() => GetUserNameFromId()
>       c.  GetCurrentTime() => GetCurrentDateTime()
>       d.  IGNORE => IGNORE_DTF in include/utils/datetime.h & utils/adt/datetim
>
> 2.  Added _P to some lex/yacc tokens:
>       CONST, CHAR, DELETE, FLOAT, GROUP, IN, OUT

Jan
2002-06-11 13:40:53 +00:00
Peter Eisentraut d60f10b0e7 Add optional "validator" function to languages that can validate the
function body (and other properties) as a function in the language
is created.  This generalizes ad hoc code that already existed for
the built-in languages.

The validation now happens after the pg_proc tuple of the new function
is created, so it is possible to define recursive SQL functions.

Add some regression test cases that cover bogus function definition
attempts.
2002-05-22 17:21:02 +00:00
Peter Eisentraut f76bc9c776 Reorder keyword token declarations alphabetically. Status of the keywords
in the various standards can be found in the documentation these days.
2002-05-19 15:16:55 +00:00
Peter Eisentraut 94bdc4855c Extend syntax of CREATE FUNCTION to resemble SQL99. 2002-05-17 18:32:52 +00:00
Tom Lane f0811a74b3 Merge the last few variable.c configuration variables into the generic
GUC support.  It's now possible to set datestyle, timezone, and
client_encoding from postgresql.conf and per-database or per-user
settings.  Also, implement rollback of SET commands that occur in a
transaction that later fails.  Create a SET LOCAL var = value syntax
that sets the variable only for the duration of the current transaction.
All per previous discussions in pghackers.
2002-05-17 01:19:19 +00:00
Tom Lane f69bc37be8 Make operators have their own comments separate from those of the
underlying function; but cause psql's \do to show the underlying
function's comment if the operator has no comment of its own, to preserve
the useful functionality of the original behavior.  Also, implement
COMMENT ON SCHEMA.  Patch from Rod Taylor.
2002-05-13 17:45:30 +00:00
Tom Lane f9e4f611a1 First pass at set-returning-functions in FROM, by Joe Conway with
some kibitzing from Tom Lane.  Not everything works yet, and there's
no documentation or regression test, but let's commit this so Joe
doesn't need to cope with tracking changes in so many files ...
2002-05-12 20:10:05 +00:00
Tom Lane 2822788993 Accept SET SESSION AUTHORIZATION DEFAULT and RESET SESSION AUTHORIZATION
to reset session userid to the originally-authenticated name.  Also,
relax SET SESSION AUTHORIZATION to allow specifying one's own username
even if one is not superuser, so as to avoid unnecessary error messages
when loading a pg_dump file that uses this command.  Per discussion from
several months ago.
2002-05-06 19:47:30 +00:00
Tom Lane 53cedcac22 Retire xlateSqlType/xlateSqlFunc; all type name translations are now
handled as special productions.  This is needed to keep us honest about
user-schema type names that happen to coincide with system type names.
Per pghackers discussion 24-Apr.  To avoid bloating the keyword list
too much, I removed the translations for datetime, timespan, and lztext,
all of which were slated for destruction several versions back anyway.
2002-05-03 00:32:19 +00:00
Tom Lane 3220fd2138 Tweak scanner/grammar interface so that the keyword-as-identifier rules
in gram.y can make use of the keywords.c string table, instead of having
their own copies of the keyword strings.  This saves a few kilobytes and
more importantly eliminates an opportunity for cut-and-paste errors.
2002-05-02 18:44:11 +00:00
Bruce Momjian 3a96b6cdeb Attached is a patch for ALTER TRIGGER RENAME per the above thread. I
left a stub for a future "ALTER RULE RENAME" but did not write that one
yet. Bruce, if you want to add my name for for that I'll take it and do
it later.

Joe Conway
2002-04-24 02:48:55 +00:00
Thomas G. Lockhart 8d2441e55c Oops. Remove declaration for set_name_needs_quotes(), since it is now gone. 2002-04-21 21:53:23 +00:00
Thomas G. Lockhart d19439f7cd Remove the definition for set_name_needs_quotes() on the assumption that
it is now obsolete. Need some regression test cases to prove otherwise...
2002-04-21 21:37:03 +00:00
Thomas G. Lockhart 37cfb04094 Make WITHOUT TIME ZONE the default for TIMESTAMP and TIME data types.
This is a big change from past behavior, but the last release was
 designed to handle this correctly for dump/restore upgrades.
Fix up handling of SET value arguments. Allow lists for most options at
 least at the parser level; multiple values may be rejected at the
 command processor of course.
Allow more variations on values for SET commands, including integer and
 float values where formerly stringy fields were required.
Check precision specification for date/time fields against the true
 precision range allowed by the data types. Especially useful with the
 new int8-based storage for these types, where precision is fixed and
 predictable.
Stub out a basic CREATE ASSERTION per SQL9x. Does not do anything (yet) but
 should be augmented as appropriate.
Minor fixups in braces and tabbing.
2002-04-21 19:21:49 +00:00
Tom Lane b0bcf8aab2 Restructure AclItem representation so that we can have more than eight
different privilege bits (might as well make use of the space we were
wasting on padding).  EXECUTE and USAGE bits for procedures, languages
now are separate privileges instead of being overlaid on SELECT.  Add
privileges for namespaces and databases.  The GRANT and REVOKE commands
work for these object types, but we don't actually enforce the privileges
yet...
2002-04-21 00:26:44 +00:00
Tom Lane 87d00363cb Make PUBLIC an unreserved word (in fact, not a keyword at all),
per previous discussion.
2002-04-18 21:16:16 +00:00
Tom Lane b3120804ad Rule names are now unique per-relation, rather than unique globally.
DROP RULE and COMMENT ON RULE syntax adds an 'ON tablename' clause,
similar to TRIGGER syntaxes.  To allow loading of existing pg_dump
files containing COMMENT ON RULE, the COMMENT code will still accept
the old syntax --- but only if the target rulename is unique across
the whole database.
2002-04-18 20:01:11 +00:00
Tom Lane 27a54ae282 Opclasses live in namespaces. I also took the opportunity to create
an 'opclass owner' column in pg_opclass.  Nothing is done with it at
present, but since there are plans to invent a CREATE OPERATOR CLASS
command soon, we'll probably want DROP OPERATOR CLASS too, which
suggests that a notion of ownership would be a good idea.
2002-04-17 20:57:57 +00:00
Tom Lane 6cef5d2549 Operators live in namespaces. CREATE/DROP/COMMENT ON OPERATOR take
qualified operator names directly, for example CREATE OPERATOR myschema.+
( ... ).  To qualify an operator name in an expression you need to write
OPERATOR(myschema.+) (thanks to Peter for suggesting an escape hatch).
I also took advantage of having to reformat pg_operator to fix something
that'd been bugging me for a while: mergejoinable operators should have
explicit links to the associated cross-data-type comparison operators,
rather than hardwiring an assumption that they are named < and >.
2002-04-16 23:08:12 +00:00
Tom Lane f2d70d32eb Functions live in namespaces. Qualified function names work, eg
SELECT schema1.func2(...).  Aggregate names can be qualified at the
syntactic level, but the qualification is ignored for the moment.
2002-04-09 20:35:55 +00:00
Bruce Momjian 97b4e5ad30 Add INSERT(..., DEFAULT, ).
Rod Taylor
2002-04-05 11:56:55 +00:00
Tom Lane 9b77f61930 ALTER TABLE SET/DROP NOT NULL, from Christopher Kings-Lynne. 2002-04-01 04:35:40 +00:00
Tom Lane 838fe25a95 Create a new GUC variable search_path to control the namespace search
path.  The default behavior if no per-user schemas are created is that
all users share a 'public' namespace, thus providing behavior backwards
compatible with 7.2 and earlier releases.  Probably the semantics and
default setting will need to be fine-tuned, but this is a start.
2002-04-01 03:34:27 +00:00
Tom Lane d5e99ab4d6 pg_type has a typnamespace column; system now supports creating types
in different namespaces.  Also, cleanup work on relation namespace
support: drop, alter, rename commands work for tables in non-default
namespaces.
2002-03-29 19:06:29 +00:00
Tom Lane 108a0ec87d A little further progress on schemas: push down RangeVars into
addRangeTableEntry calls.  Remove relname field from RTEs, since
it will no longer be a useful unique identifier of relations;
we want to encourage people to rely on the relation OID instead.
Further work on dumping qual expressions in EXPLAIN, too.
2002-03-22 02:56:37 +00:00
Tom Lane 95ef6a3448 First phase of SCHEMA changes, concentrating on fixing the grammar and
the parsetree representation.  As yet we don't *do* anything with schema
names, just drop 'em on the floor; but you can enter schema-compatible
command syntax, and there's even a primitive CREATE SCHEMA command.
No doc updates yet, except to note that you can now extract a field
from a function-returning-row's result with (foo(...)).fieldname.
2002-03-21 16:02:16 +00:00
Tom Lane 337b22cb47 Code review for DOMAIN patch. 2002-03-20 19:45:13 +00:00
Bruce Momjian b9c7b0a2ba Fix DOMAIN breakage. 2002-03-19 12:52:22 +00:00
Bruce Momjian d3788c3305 Add DOMAIN support. Includes manual pages and regression tests, from
Rod Taylor.
2002-03-19 02:18:25 +00:00
Bruce Momjian a35b6b6418 Add DEFAULT_INDEX_TYPE == "btree", for clarity. 2002-03-10 06:02:24 +00:00
Bruce Momjian ee27436f6c Disable brackets in multi-statement rules, as discussed. 2002-03-10 06:00:15 +00:00
Thomas G. Lockhart f20509551d Guard against NULL strings in SET key=val constructs.
Problem noted by Fernando Nasser.
2002-03-09 17:37:16 +00:00
Tom Lane cf68a686a6 Fix copying/equality-check bugs in GrantStmt and ConstraintsSetStmt,
per reports from Fernando Nasser.  Also, rearrange order of declarations
in parsenodes.h as suggested by Fernando.
2002-03-08 04:37:18 +00:00
Bruce Momjian b976b8af80 Back out domain patch until it works properly. 2002-03-07 16:35:41 +00:00
Bruce Momjian 01c76f7411 Ok. Updated patch attached.
- domain.patch -> source patch against pgsql in cvs
- drop_domain.sgml and create_domain.sgml -> New doc/src/sgml/ref docs

- dominfo.txt -> basic domain related queries I used for testing
[ ADDED TO /doc]

Enables domains of array elements -> CREATE DOMAIN dom int4[3][2];

Uses a typbasetype column to describe the origin of the domain.

Copies data to attnotnull rather than processing in execMain().

Some documentation differences from earlier.

If this is approved, I'll start working on pg_dump, and a \dD <domain>
option in psql, and regression tests.  I don't really feel like doing
those until the system table structure settles for pg_type.


CHECKS when added, will also be copied to to the table attributes.  FK
Constraints (if I ever figure out how) will be done similarly.  Both
will lbe handled by MergeDomainAttributes() which is called shortly
before MergeAttributes().

Rod Taylor
2002-03-06 20:35:02 +00:00
Bruce Momjian 92288a1cf9 Change made to elog:
o  Change all current CVS messages of NOTICE to WARNING.  We were going
to do this just before 7.3 beta but it has to be done now, as you will
see below.

o Change current INFO messages that should be controlled by
client_min_messages to NOTICE.

o Force remaining INFO messages, like from EXPLAIN, VACUUM VERBOSE, etc.
to always go to the client.

o Remove INFO from the client_min_messages options and add NOTICE.

Seems we do need three non-ERROR elog levels to handle the various
behaviors we need for these messages.

Regression passed.
2002-03-06 06:10:59 +00:00
Bruce Momjian 03194432de I attach a version of my toast-slicing patch, against current CVS
(current as of a few hours ago.)

This patch:

1. Adds PG_GETARG_xxx_P_SLICE() macros and associated support routines.

2. Adds routines in src/backend/access/tuptoaster.c for fetching only
necessary chunks of a toasted value. (Modelled on latest changes to
assume chunks are returned in order).

3. Amends text_substr and bytea_substr to use new methods. It now
handles multibyte cases -and should still lead to a performance
improvement in the multibyte case where the substring is near the
beginning of the string.

4. Added new command: ALTER TABLE tabname ALTER COLUMN colname SET
STORAGE {PLAIN | EXTERNAL | EXTENDED | MAIN} to parser and documented in
alter-table.sgml. (NB I used ColId as the item type for the storage
mode string, rather than a new production - I hope this makes sense!).
All this does is sets attstorage for the specified column.

4. AlterTableAlterColumnStatistics is now AlterTableAlterColumnFlags and
handles both statistics and storage (it uses the subtype code to
distinguish). The previous version of my patch also re-arranged other
code in backend/commands/command.c but I have dropped that from this
patch.(I plan to return to it separately).

5. Documented new macros (and also the PG_GETARG_xxx_P_COPY macros) in
xfunc.sgml. ref/alter_table.sgml also contains documentation for ALTER
COLUMN SET STORAGE.

John Gray
2002-03-05 05:33:31 +00:00
Bruce Momjian a033daf566 Commit to match discussed elog() changes. Only update is that LOG is
now just below FATAL in server_min_messages.  Added more text to
highlight ordering difference between it and client_min_messages.

---------------------------------------------------------------------------

REALLYFATAL => PANIC
STOP => PANIC
New INFO level the prints to client by default
New LOG level the prints to server log by default
Cause VACUUM information to print only to the client
NOTICE => INFO where purely information messages are sent
DEBUG => LOG for purely server status messages
DEBUG removed, kept as backward compatible
DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1 added
DebugLvl removed in favor of new DEBUG[1-5] symbols
New server_min_messages GUC parameter with values:
        DEBUG[5-1], INFO, NOTICE, ERROR, LOG, FATAL, PANIC
New client_min_messages GUC parameter with values:
        DEBUG[5-1], LOG, INFO, NOTICE, ERROR, FATAL, PANIC
Server startup now logged with LOG instead of DEBUG
Remove debug_level GUC parameter
elog() numbers now start at 10
Add test to print error message if older elog() values are passed to elog()
Bootstrap mode now has a -d that requires an argument, like postmaster
2002-03-02 21:39:36 +00:00
Peter Eisentraut 1aac2c852a User and database-specific session defaults for run-time configuration
variables.  New commands ALTER DATABASE ... SET and ALTER USER ... SET.
2002-03-01 22:45:19 +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
Peter Eisentraut 8adf56f77a Privileges on functions and procedural languages 2002-02-18 23:11:58 +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
Thomas G. Lockhart eda51264c8 Allow variable (unrestricted) precision for TIME and TIMESTAMP types in parser. 2001-12-09 04:39:39 +00:00