diff options
| author | Peter Eisentraut | 2011-02-12 13:54:13 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2011-02-12 13:55:18 +0000 |
| commit | b313bca0afce3ab9dab0a77c64c0982835854b9a (patch) | |
| tree | 862203ffd9adbc62684bec05fa32b2de4713e6b9 /src/include | |
| parent | d31e2a495b6f2127afc31b4da2e5f4e89aa2cdfe (diff) | |
DDL support for collations
- collowner field
- CREATE COLLATION
- ALTER COLLATION
- DROP COLLATION
- COMMENT ON COLLATION
- integration with extensions
- pg_dump support for the above
- dependency management
- psql tab completion
- psql \dO command
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
| -rw-r--r-- | src/include/catalog/dependency.h | 1 | ||||
| -rw-r--r-- | src/include/catalog/pg_collation.h | 12 | ||||
| -rw-r--r-- | src/include/catalog/pg_collation_fn.h | 23 | ||||
| -rw-r--r-- | src/include/catalog/pg_type_fn.h | 1 | ||||
| -rw-r--r-- | src/include/commands/collationcmds.h | 28 | ||||
| -rw-r--r-- | src/include/commands/dbcommands.h | 2 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 1 | ||||
| -rw-r--r-- | src/include/parser/kwlist.h | 1 | ||||
| -rw-r--r-- | src/include/utils/acl.h | 2 |
10 files changed, 67 insertions, 6 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index aa40e221021..e87e64fc7a4 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201102101 +#define CATALOG_VERSION_NO 201102121 #endif diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index eda41d69216..582294c6b3b 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -121,6 +121,7 @@ typedef enum ObjectClass OCLASS_PROC, /* pg_proc */ OCLASS_TYPE, /* pg_type */ OCLASS_CAST, /* pg_cast */ + OCLASS_COLLATION, /* pg_collation */ OCLASS_CONSTRAINT, /* pg_constraint */ OCLASS_CONVERSION, /* pg_conversion */ OCLASS_DEFAULT, /* pg_attrdef */ diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h index 9883b4daf38..42a70e8f25f 100644 --- a/src/include/catalog/pg_collation.h +++ b/src/include/catalog/pg_collation.h @@ -32,6 +32,7 @@ CATALOG(pg_collation,3456) { NameData collname; /* collation name */ Oid collnamespace; /* OID of namespace containing this collation */ + Oid collowner; int4 collencoding; /* encoding that this collation applies to */ NameData collcollate; /* LC_COLLATE setting */ NameData collctype; /* LC_CTYPE setting */ @@ -48,14 +49,15 @@ typedef FormData_pg_collation *Form_pg_collation; * compiler constants for pg_collation * ---------------- */ -#define Natts_pg_collation 5 +#define Natts_pg_collation 6 #define Anum_pg_collation_collname 1 #define Anum_pg_collation_collnamespace 2 -#define Anum_pg_collation_collencoding 3 -#define Anum_pg_collation_collcollate 4 -#define Anum_pg_collation_collctype 5 +#define Anum_pg_collation_collowner 3 +#define Anum_pg_collation_collencoding 4 +#define Anum_pg_collation_collcollate 5 +#define Anum_pg_collation_collctype 6 -DATA(insert OID = 100 ( default PGNSP 0 "" "" )); +DATA(insert OID = 100 ( default PGNSP PGUID 0 "" "" )); DESCR("placeholder for default collation"); #define DEFAULT_COLLATION_OID 100 diff --git a/src/include/catalog/pg_collation_fn.h b/src/include/catalog/pg_collation_fn.h new file mode 100644 index 00000000000..63a9cf2d63e --- /dev/null +++ b/src/include/catalog/pg_collation_fn.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * pg_collation_fn.h + * prototypes for functions in catalog/pg_collation.c + * + * + * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_collation_fn.h + * + *------------------------------------------------------------------------- + */ +#ifndef PG_COLLATION_FN_H +#define PG_COLLATION_FN_H + +extern Oid CollationCreate(const char *collname, Oid collnamespace, + Oid collowner, + int32 collencoding, + const char *collcollate, const char *collctype); +extern void RemoveCollationById(Oid collationOid); + +#endif /* PG_COLLATION_FN_H */ diff --git a/src/include/catalog/pg_type_fn.h b/src/include/catalog/pg_type_fn.h index 81508698db3..81e7d7fec34 100644 --- a/src/include/catalog/pg_type_fn.h +++ b/src/include/catalog/pg_type_fn.h @@ -68,6 +68,7 @@ extern void GenerateTypeDependencies(Oid typeNamespace, Oid elementType, bool isImplicitArray, Oid baseType, + Oid typeCollation, Node *defaultExpr, bool rebuild); diff --git a/src/include/commands/collationcmds.h b/src/include/commands/collationcmds.h new file mode 100644 index 00000000000..60504694a5b --- /dev/null +++ b/src/include/commands/collationcmds.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------------------------- + * + * collationcmds.h + * prototypes for collationcmds.c. + * + * + * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/commands/collationcmds.h + * + *------------------------------------------------------------------------- + */ + +#ifndef COLLATIONCMDS_H +#define COLLATIONCMDS_H + +#include "nodes/parsenodes.h" + +extern void DefineCollation(List *names, List *parameters); +extern void DropCollationsCommand(DropStmt *drop); +extern void RenameCollation(List *name, const char *newname); +extern void AlterCollationOwner(List *name, Oid newOwnerId); +extern void AlterCollationOwner_oid(Oid collationOid, Oid newOwnerId); +extern void AlterCollationNamespace(List *name, const char *newschema); +extern Oid AlterCollationNamespace_oid(Oid collOid, Oid newNspOid); + +#endif /* COLLATIONCMDS_H */ diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h index 809754792a9..f54c57907a1 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -65,4 +65,6 @@ extern char *get_database_name(Oid dbid); extern void dbase_redo(XLogRecPtr lsn, XLogRecord *rptr); extern void dbase_desc(StringInfo buf, uint8 xl_info, char *rec); +extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype); + #endif /* DBCOMMANDS_H */ diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 1aa3e913b54..8aaa8c1d2f7 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -1070,6 +1070,7 @@ typedef enum ObjectType OBJECT_CAST, OBJECT_COLUMN, OBJECT_CONSTRAINT, + OBJECT_COLLATION, OBJECT_CONVERSION, OBJECT_DATABASE, OBJECT_DOMAIN, diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h index 4939b493bc2..f288c765925 100644 --- a/src/include/parser/kwlist.h +++ b/src/include/parser/kwlist.h @@ -79,6 +79,7 @@ PG_KEYWORD("close", CLOSE, UNRESERVED_KEYWORD) PG_KEYWORD("cluster", CLUSTER, UNRESERVED_KEYWORD) PG_KEYWORD("coalesce", COALESCE, COL_NAME_KEYWORD) PG_KEYWORD("collate", COLLATE, RESERVED_KEYWORD) +PG_KEYWORD("collation", COLLATION, UNRESERVED_KEYWORD) PG_KEYWORD("column", COLUMN, RESERVED_KEYWORD) PG_KEYWORD("comment", COMMENT, UNRESERVED_KEYWORD) PG_KEYWORD("comments", COMMENTS, UNRESERVED_KEYWORD) diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index aac74427104..1e9cf7fbed9 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -188,6 +188,7 @@ typedef enum AclObjectKind ACL_KIND_NAMESPACE, /* pg_namespace */ ACL_KIND_OPCLASS, /* pg_opclass */ ACL_KIND_OPFAMILY, /* pg_opfamily */ + ACL_KIND_COLLATION, /* pg_collation */ ACL_KIND_CONVERSION, /* pg_conversion */ ACL_KIND_TABLESPACE, /* pg_tablespace */ ACL_KIND_TSDICTIONARY, /* pg_ts_dict */ @@ -309,6 +310,7 @@ extern bool pg_tablespace_ownercheck(Oid spc_oid, Oid roleid); extern bool pg_opclass_ownercheck(Oid opc_oid, Oid roleid); extern bool pg_opfamily_ownercheck(Oid opf_oid, Oid roleid); extern bool pg_database_ownercheck(Oid db_oid, Oid roleid); +extern bool pg_collation_ownercheck(Oid coll_oid, Oid roleid); extern bool pg_conversion_ownercheck(Oid conv_oid, Oid roleid); extern bool pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid); extern bool pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid); |
