1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Add CREATE COLLATION IF NOT EXISTS clause

The core of the functionality was already implemented when
pg_import_system_collations was added.  This just exposes it as an
option in the SQL command.
This commit is contained in:
Peter Eisentraut
2017-02-08 22:51:09 -05:00
parent e403732ef6
commit 6d16ecc646
10 changed files with 47 additions and 6 deletions

View File

@ -37,7 +37,7 @@
* CREATE COLLATION
*/
ObjectAddress
DefineCollation(ParseState *pstate, List *names, List *parameters)
DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_exists)
{
char *collName;
Oid collNamespace;
@ -137,7 +137,7 @@ DefineCollation(ParseState *pstate, List *names, List *parameters)
GetDatabaseEncoding(),
collcollate,
collctype,
false);
if_not_exists);
if (!OidIsValid(newoid))
return InvalidObjectAddress;