Commit Graph

875 Commits

Author SHA1 Message Date
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 3389a110d4 Get rid of long-since-vestigial Iter node type, in favor of adding a
returns-set boolean field in Func and Oper nodes.  This allows cleaner,
more reliable tests for expressions returning sets in the planner and
parser.  For example, a WHERE clause returning a set is now detected
and complained of in the parser, not only at runtime.
2002-05-12 23:43:04 +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 72a3902a66 Create an internal semaphore API that is not tied to SysV semaphores.
As proof of concept, provide an alternate implementation based on POSIX
semaphores.  Also push the SysV shared-memory implementation into a
separate file so that it can be replaced conveniently.
2002-05-05 00:03:29 +00:00
Tom Lane d662f29302 Use quote_identifier on relation names in EXPLAIN output, per suggestion
from Liam Stewart.  Minor code cleanups also.
2002-05-03 15:56:45 +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 4c25a0655b Code review for ALTER TRIGGER RENAME patch: make better use of index,
don't scribble on tuple returned by table scan.
2002-04-30 01:24:57 +00:00
Tom Lane 7677fe0aa6 Minor code cleanup. 2002-04-28 00:36:38 +00:00
Tom Lane c06f6a6bc2 Support toasting of shared system relations, and provide toast tables for
pg_database, pg_shadow, pg_group, all of which now have potentially-long
fields.  Along the way, get rid of SharedSystemRelationNames list: shared
rels are now identified in their include/pg_catalog/*.h files by a
BKI_SHARED_RELATION macro, while indexes and toast rels inherit sharedness
automatically from their parent table.  Fix some bugs with failure to detoast
pg_group.grolist during ALTER GROUP.
2002-04-27 21:24:34 +00:00
Bruce Momjian 108871f4fc Fix write of pg_pwd file for multiple users. Broken recently by my
pg_hba.conf changes.
2002-04-27 15:30:07 +00:00
Tom Lane 31c775adeb Restructure aclcheck error reporting to make permission-failure
messages more uniform and internationalizable: the global array
aclcheck_error_strings[] is gone in favor of a subroutine
aclcheck_error().  Partial implementation of namespace-related
permission checks --- not all done yet.
2002-04-27 03:45:03 +00:00
Tom Lane 7de307f96c Move renametrig() from tablecmds.c to trigger.c --- if we're going to
divide backend/commands by object type, let's try to pay at least
minimal attention to respecting that structure, eh?  Also reorder the
contents of tablecmds.c; it seems odd to me to put ALTER commands before
creation/deletion commands.
2002-04-26 19:29:47 +00:00
Bruce Momjian ab117a6643 Restrict comment to the current database in order to prevent them from
mysteriously disappearing.

ie.  \d+ will only ever show the comment for the current database --
which is appropriate since it can only pull comments from the current
database.

Won't break pgadmin functionality as it enforces this behaviour already.


I didn't find any regression tests for COMMENT.

Rod Taylor
2002-04-24 02:50:30 +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
Bruce Momjian adf7cc04cb Doc fix for INSERT ... (DEFAULT, ...)
Appears I forgot to update the docs earlier.

Rod Taylor
2002-04-24 02:38:58 +00:00
Tom Lane 5dd1c713d0 Oops, forgot we had a macro to encapsulate test for type toastability. 2002-04-22 21:56:06 +00:00
Tom Lane 3faf224ace Fix incorrect Assert; install a more trustworthy check on whether
ALTER COLUMN SET STORAGE should be allowed.
2002-04-22 21:46:11 +00:00
Thomas G. Lockhart 3c184d18ef Convert GUC parameters back to strings if input as integers.
Change elog(ERROR) messages to say that a variable takes one parameter,
 rather than saying that it does not take multiple parameters.
2002-04-22 15:13:53 +00:00
Thomas G. Lockhart 58ca6e091e Check for multiple arguments on parameters which do not allow them.
The last version caught this with an assert because I wasn't sure whether
 we should elog(ERROR) or just loop through the parameters.
2002-04-22 14:34:27 +00:00
Thomas G. Lockhart b875b599f3 Initialize or set a couple of variables to suppress compiler warnings.
These were for cases protected by elog(ERROR) exits, but may as well
 keep the compiler happy. Not sure why they don't show up on my gcc-2.96.x
 version of the compiler.
2002-04-21 21:35:17 +00:00
Thomas G. Lockhart e53f94ad68 Allow more choices for style of value in various SET commands. Formerly,
most required a stringy syntax in the parser; now integers and floats
 can (or should) be handled. There is at least one cheesy error message
 mentioning sending mail to me if there are problems; should be changed
 prior to release.
Allow lists of values from the parser in more cases. If multiple arguments
 were not allowed previously, they probably are not allowed now, but at
 least the data structures being passed around are more consistant across
 more cases.
2002-04-21 19:12:46 +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 6d6ca2166c Change naming rule for ON SELECT rules of views: they're all just
_RETURN now, since there's no need to keep 'em unique anymore.
2002-04-19 23:13:54 +00:00
Tom Lane 201737168c pg_trigger's index on tgrelid is replaced by a unique index on
(tgrelid, tgname).  This provides an additional check on trigger name
uniqueness per-table (which was already enforced by the code anyway).
With this change, RelationBuildTriggers will read the triggers in
order by tgname, since it's scanning using this index.  Since a
predictable trigger ordering has been requested for some time, document
this behavior as a feature.  Also document that rules fire in name
order, since yesterday's changes to pg_rewrite indexing cause that too.
2002-04-19 16:36:08 +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
Bruce Momjian bbae09c2cb CATALOG VERSION UPDATED:
The indexes on most system catalogs are named with the suffix "_index";
not so with TOAST table indexes, which use "_idx". This trivial patch
changes TOAST table index names to use the "_index" suffix for
consistency.

Neil Conway
2002-04-15 23:45:07 +00:00
Bruce Momjian 2036b3fc59 Disable VACUUM from being called from a function because function memory
would be cleared by vacuum;  fix idea from Tom Lane.
2002-04-15 23:39:42 +00:00
Tom Lane 71dc300a37 The contents of command.c, creatinh.c, define.c, remove.c and rename.c
have been divided according to the type of object manipulated - so ALTER
TABLE code is in tablecmds.c, aggregate commands in aggregatecmds.c and
so on.

A few common support routines remain in define.c (prototypes in
src/include/commands/defrem.h).

No code has been changed except for includes to reflect the new files.
The prototypes for aggregatecmds.c, functioncmds.c, operatorcmds.c,
and typecmds.c remain in src/include/commands/defrem.h.

From John Gray <jgray@azuli.co.uk>
2002-04-15 05:22:04 +00:00
Bruce Momjian 872911bc41 Fix comment dashes. 2002-04-14 16:47:16 +00:00
Tom Lane 9999f5a10e Checking to decide whether relations are system relations now depends
on the namespace not the name; pg_ is not a reserved prefix for table
names anymore.  From Fernando Nasser.
2002-04-12 20:38:31 +00:00
Bruce Momjian 50b5d4bf76 Add mention of function CREATE INDEX usage. 2002-04-11 23:20:04 +00:00
Tom Lane 902a6a0a4b Restructure representation of aggregate functions so that they have pg_proc
entries, per pghackers discussion.  This fixes aggregates to live in
namespaces, and also simplifies/speeds up lookup in parse_func.c.
Also, add a 'proimplicit' flag to pg_proc that controls whether a type
coercion function may be invoked implicitly, or only explicitly.  The
current settings of these flags are more permissive than I would like,
but we will need to debate and refine the behavior; for now, I avoided
breaking regression tests as much as I could.
2002-04-11 20:00:18 +00:00
Peter Eisentraut 25f050d90d Make sure that usesuper is always accessed through superuser(), so that the
single-user escape path always works.
2002-04-11 05:32:03 +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 80f46fab63 This patch adds a missing heap_freetuple() to renamerel(), documents
the decision not to make renamerel() update the sequence name that
is stored within sequences themselves (thanks to Tom Lane), and adds
some rudimentary regression tests for ALTER TABLE ... RENAME on
non-table relations.

Neil Conway
2002-04-05 11:58:24 +00:00
Tom Lane 4bdb4be62e Divide functions into three volatility classes (immutable, stable, and
volatile), rather than the old cachable/noncachable distinction.  This
allows indexscan optimizations in many places where we formerly didn't.
Also, add a pronamespace column to pg_proc (it doesn't do anything yet,
however).
2002-04-05 00:31:36 +00:00
Bruce Momjian 43a3543a4e Authentication improvements:
A new pg_hba.conf column, USER
Allow specifiction of lists of users separated by commas
Allow group names specified by +
Allow include files containing lists of users specified by @
Allow lists of databases, and database files
Allow samegroup in database column to match group name matching dbname
Removal of secondary password files
Remove pg_passwd utility
Lots of code cleanup in user.c and hba.c
New data/global/pg_pwd format
New data/global/pg_group file
2002-04-04 04:25:54 +00:00
Hiroshi Inoue c26a44db08 Removed obsolete DROP_COLUMN_HACK stuff. 2002-04-02 08:51:52 +00:00
Tom Lane 9c54cfb493 Fix CLOG truncation code to not do the Wrong Thing when there are already
wrapped-around databases.  The unvacuumed databases might be fine, or
they might not, but things will definitely not be fine if we remove the
wrong CLOG segments.  Per trouble report from Gary Wolfe, 1-Apr-2002.
2002-04-02 05:11:55 +00:00
Tom Lane 1dc43ea75f Make VACUUM handle schema-qualified relation names properly. 2002-04-02 01:03:07 +00:00
Tom Lane 789ddcb5fe Add tgconstrrelid to stored Trigger structures, make RI trigger functions
depend on this rather than the trigger argument strings to locate the
other relation to test.  This makes RI triggers function properly in
the presence of schemas and temp tables.  Along the way, fix bogus lack
of locking in RI triggers, handle quoting of names fully correctly,
compute required sizes of query buffers with some semblance of accuracy.
2002-04-01 22:36:13 +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 d51675169f Make renamerel take an OID, not a RangeVar, to identify the relation
to rename.  Avoids some corner-case bugs in cluster.c, improves
consistency with renameatt.
2002-03-31 07:49:30 +00:00
Tom Lane 3114102521 Reimplement temp tables using schemas. The temp table map is history;
temp table entries in pg_class have the names the user would expect.
2002-03-31 06:26:32 +00:00
Tom Lane 5f4745adf4 Further cleanups for relations in schemas: teach nextval and other
sequence functions how to cope with qualified names.  Same code is
also used for int4notin, currtid_byrelname, pgstattuple.  Also,
move TOAST tables into special pg_toast namespace.
2002-03-30 01:02:42 +00:00