Created
March 11, 2013 21:48
-
-
Save michaeljforster-zz/5138094 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foobar=# begin; create table foo (id serial primary key); alter table foo rename to bar; commit; | |
| BEGIN | |
| NOTICE: CREATE TABLE will create implicit sequence "foo_id_seq" for serial column "foo.id" | |
| NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo" | |
| CREATE TABLE | |
| ALTER TABLE | |
| COMMIT | |
| foobar=# \d | |
| List of relations | |
| Schema | Name | Type | Owner | |
| --------+------------+----------+---------- | |
| public | bar | table | postgres | |
| public | foo_id_seq | sequence | postgres | |
| (2 rows) | |
| foobar=# begin; create table foo (id serial primary key); alter table foo rename to bar; commit; | |
| BEGIN | |
| NOTICE: CREATE TABLE will create implicit sequence "foo_id_seq1" for serial column "foo.id" | |
| NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey1" for table "foo" | |
| CREATE TABLE | |
| ERROR: relation "bar" already exists | |
| ROLLBACK | |
| foobar=# \d | |
| List of relations | |
| Schema | Name | Type | Owner | |
| --------+------------+----------+---------- | |
| public | bar | table | postgres | |
| public | foo_id_seq | sequence | postgres | |
| (2 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment