Log In - Home Page

Patch: CREATE SCHEMA IF NOT EXISTS

Edit Patch - Move To Another CommitFest - Delete Patch

CommitFest 2012-09
Topic Server Features
Patch Status Committed
Author FabrÝzio de Royes Mello
Reviewers Dickson S. Guedes
Committer Tom Lane
Close Date 2012-10-03
Comments
Patch by fabriziomello on 2012-08-16 05:50:14 PM: (v1) Initial version.
Patch by fabriziomello on 2012-08-17 01:47:49 PM: (v2) Implementation of regression tests
Patch by fabriziomello on 2012-08-17 02:01:04 PM: (v3) Fix a little mistake in create_schema.sgml
Patch by fabriziomello on 2012-08-17 03:02:44 PM: (v4) Added support for the new field in the node in "copyfuncs.c" and "equalfuncs.c".
Patch by fabriziomello on 2012-08-17 09:45:05 PM: (v5) Ajust "extension.c" when call "CreateSchemaCommand" to set "if_not_exists" field in the node.
Review by guedes on 2012-08-28 10:55:45 AM: Applied to 483c2c1071c45e275782d33d646c3018f02f9f94, compiled and passed all tests.

Two questions:

- Should this patch implements others INEs like ADD COLUMN IF NOT EXISTS?
- Should pg_dump or pg_restore support some kind of flag to use a
CREATE SCHEMA IF NOT EXISTS ... instead CREATE SCHEMA ...?
Comment by tgl on 2012-09-21 06:00:27 PM: There are a lot of definitional issues here that don't seem to have been thought about.
Patch by fabriziomello on 2012-09-23 11:07:20 PM: (v6) the attached patch skip only the schema creation and execute others statements
Comment by vog on 2012-09-29 10:02:39 AM: The following INEs should be implemented, too:

CREATE [ TEMPORARY | TEMP ] SEQUENCE [ IF NOT EXISTS ] name ...
ALTER TABLE ... ADD [ COLUMN ] [ IF NOT EXISTS ] column_name ...
CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ IF NOT EXISTS ] [ name ] ON ...
Patch by fabriziomello on 2012-10-03 05:59:35 PM: (v7) The attached patch throw an error if we use "IF NOT EXISTS" with schema elements.

Add Comment

Please log in to comment on this patch.