summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-06-10 17:56:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-06-10 17:56:03 +0000
commit45616f5bbbb87745e0e82b00e77562d6502aa042 (patch)
tree18d24d180f5c0c954268e64f5b6fe62922fc106e /src/include
parent75db5a665fac305ac0170f49f39c1b01d026e8d3 (diff)
downloadpostgresql-45616f5bbbb87745e0e82b00e77562d6502aa042.tar.gz
Clean up generation of default names for constraints, indexes, and serial
sequences, as per recent discussion. All these names are now of the form table_column_type, with digits added if needed to make them unique. Default constraint names are chosen to be unique across their whole schema, not just within the parent object, so as to be more SQL-spec-compatible and make the information schema views more useful.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/pg_constraint.h21
-rw-r--r--src/include/commands/defrem.h6
-rw-r--r--src/include/parser/analyze.h6
3 files changed, 16 insertions, 17 deletions
diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h
index fe836010ec..245b999205 100644
--- a/src/include/catalog/pg_constraint.h
+++ b/src/include/catalog/pg_constraint.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_constraint.h,v 1.10 2003/11/29 22:40:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_constraint.h,v 1.11 2004/06/10 17:55:59 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -141,15 +141,14 @@ typedef FormData_pg_constraint *Form_pg_constraint;
*/
/*
- * Used for constraint support functions where the
- * and conrelid, contypid columns being looked up
+ * Identify constraint type for lookup purposes
*/
-typedef enum CONSTRAINTCATEGORY
+typedef enum ConstraintCategory
{
CONSTRAINT_RELATION,
CONSTRAINT_DOMAIN,
- CONSTRAINT_ASSERTION
-} CONSTRAINTCATEGORY;
+ CONSTRAINT_ASSERTION /* for future expansion */
+} ConstraintCategory;
/*
* prototypes for functions in pg_constraint.c
@@ -176,10 +175,10 @@ extern Oid CreateConstraintEntry(const char *constraintName,
extern void RemoveConstraintById(Oid conId);
-extern bool ConstraintNameIsUsed(CONSTRAINTCATEGORY conCat, Oid objId, Oid objNamespace,
- const char *cname);
-extern char *GenerateConstraintName(CONSTRAINTCATEGORY conCat, Oid objId, Oid objNamespace,
- int *counter);
-extern bool ConstraintNameIsGenerated(const char *cname);
+extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
+ Oid objNamespace, const char *conname);
+extern char *ChooseConstraintName(const char *name1, const char *name2,
+ const char *label, Oid namespace,
+ List *others);
#endif /* PG_CONSTRAINT_H */
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index 892aee34ae..ba7415a582 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.56 2004/05/14 16:11:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.57 2004/06/10 17:55:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,6 +35,10 @@ extern void RemoveIndex(RangeVar *relation, DropBehavior behavior);
extern void ReindexIndex(RangeVar *indexRelation, bool force);
extern void ReindexTable(RangeVar *relation, bool force);
extern void ReindexDatabase(const char *databaseName, bool force, bool all);
+extern char *makeObjectName(const char *name1, const char *name2,
+ const char *label);
+extern char *ChooseRelationName(const char *name1, const char *name2,
+ const char *label, Oid namespace);
/* commands/functioncmds.c */
extern void CreateFunction(CreateFunctionStmt *stmt);
diff --git a/src/include/parser/analyze.h b/src/include/parser/analyze.h
index 76c77025ec..29784d041e 100644
--- a/src/include/parser/analyze.h
+++ b/src/include/parser/analyze.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/parser/analyze.h,v 1.26 2004/05/05 04:48:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/parser/analyze.h,v 1.27 2004/06/10 17:56:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,10 +21,6 @@ extern List *parse_analyze_varparams(Node *parseTree, Oid **paramTypes,
int *numParams);
extern List *parse_sub_analyze(Node *parseTree, ParseState *parentParseState);
extern List *analyzeCreateSchemaStmt(CreateSchemaStmt *stmt);
-
-extern char *makeObjectName(const char *name1, const char *name2,
- const char *typename);
-
extern void CheckSelectForUpdate(Query *qry);
#endif /* ANALYZE_H */