Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
От | Andres Freund |
---|---|
Тема | Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements |
Дата | |
Msg-id | 20130624110526.GC6471@awork2.anarazel.de обсуждение исходный текст |
Ответ на | Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements (Fabrízio de Royes Mello <fabriziomello@gmail.com>) |
Ответы |
Re: Patch to add support of "IF NOT EXISTS" to others
"CREATE" statements
|
Список | pgsql-hackers |
On 2013-06-12 14:29:59 -0300, Fabrízio de Royes Mello wrote: > On Fri, May 24, 2013 at 12:22 PM, Fabrízio de Royes Mello < > fabriziomello@gmail.com> wrote: > > > Hi all, > > > > I working in a patch to include support of "IF NOT EXISTS" into "CREATE" > > statements that not have it yet. > > > > I started with "DefineStmt" section from "src/backend/parser/gram.y": > > - CREATE AGGREGATE [ IF NOT EXISTS ] ... > > - CREATE OPERATOR [ IF NOT EXISTS ] ... > > - CREATE TYPE [ IF NOT EXISTS ] ... [AS [{ENUM | RANGE}] (...)] > > - CREATE TEXT SEARCH {PARSER | DITIONARY | TEMPLATE | CONFIGURATION} [ IF > > NOT EXISTS ] ... > > - CREATE COLLATION [ IF NOT EXISTS ] ... > > > > > The attached patch add support to "IF NOT EXISTS" to "CREATE" statements > listed below: > > - CREATE AGGREGATE [ IF NOT EXISTS ] ... > - CREATE CAST [ IF NOT EXISTS ] ... > - CREATE COLLATION [ IF NOT EXISTS ] ... > - CREATE OPERATOR [ IF NOT EXISTS ] ... > - CREATE TEXT SEARCH {PARSER | DICTIONARY | TEMPLATE | CONFIGURATION} [ IF > NOT EXISTS ] ... > - CREATE TYPE [ IF NOT EXISTS ] ... [AS [{ENUM | RANGE}] (...)] I'd argue if we go that way - which seems to be a good idea - we really ought to make a complete pass and add it to all commands where it's currently missing. * CREATE DOMAIN * CREATE GROUP * CREATE TABLE AS * CREATE MATERIALIZED VIEW * CREATE SEQUENCE (we have ALTER but not CREATE?) * CREATE TABLESPACE (arguably slightly harder) * CREATE FOREIGN DATA WRAPPER * CREATE SERVER * CREATE DATABASE * CREATE USER MAPPING * CREATE TRIGGER * CREATE EVENT TRIGGER * CREATE INDEX * CLUSTER Cases that seem useful, even though we have OR REPLACE: * CREATE VIEW * CREATE FUNCTION Of dubious use: * CREATE OPERATOR CLASS * CREATE OPERATOR FAMILY * CREATE RULE * CREATE CONVERSION Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-hackers по дате отправления: