diff options
author | Bruce Momjian <bruce@momjian.us> | 2001-09-07 21:57:53 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2001-09-07 21:57:53 +0000 |
commit | bd9b32803bee2a85e41deb5e546c3b0e16912e2b (patch) | |
tree | 0528a43344227ddbf5e65a466996c5a3089917c0 /src/backend/parser/analyze.c | |
parent | 68e190cfa4d3f121de310fbbad89b4f26fb9198f (diff) |
Here is my much-promised patch to let people add UNIQUE constraints after
table creation time. Big deal you say - but this patch is the basis of the
next thing which is adding PRIMARY KEYs after table creation time. (Which
is currently impossible without twiddling catalogs)
Rundown
-------
* I have made the makeObjectName function of analyze.c non-static, and
exported it in analyze.h
* I have included analyze.h and defrem.h into command.c, to support
makingObjectNames and creating indices
* I removed the 'case CONSTR_PRIMARY' clause so that it properly fails and
says you can't add primary keys, rather than just doing nothing and
reporting nothing!!!
* I have modified the docs.
Algorithm
---------
* If name specified is null, search for a new valid constraint name. I'm
not sure if I should "lock" my generated name somehow tho - should I open
the relation before doing this step?
* Open relation in access exclusive mode
* Check that the constraint does not already exist
* Define the new index
* Warn if they're doubling up on an existing index
Christopher Kings-Lynne
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r-- | src/backend/parser/analyze.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 528cc91c96d..4f1bf724dba 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.197 2001/08/24 20:03:45 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.198 2001/09/07 21:57:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -562,7 +562,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) * from the truncated characters. Currently it seems best to keep it simple, * so that the generated names are easily predictable by a person. */ -static char * +char * makeObjectName(char *name1, char *name2, char *typename) { char *name; |