~/paste/1015
~/paste/1015
~/paste/1015

  1. postgres=# CREATE TABLE x (
  2. postgres(#         id              SERIAL PRIMARY KEY,
  3. postgres(#         content         VARCHAR(255) DEFAULT NULL
  4. postgres(# );
  5. NOTICE:  CREATE TABLE will CREATE implicit SEQUENCE "x_id_seq" FOR serial COLUMN "x.id"
  6. NOTICE:  CREATE TABLE / PRIMARY KEY will CREATE implicit INDEX "x_pkey" FOR TABLE "x"
  7. CREATE TABLE
  8. postgres=# \d x
  9.                                  TABLE "public.x"
  10.  COLUMN  |          TYPE          |                   Modifiers                    
  11. ---------+------------------------+------------------------------------------------
  12.  id      | INTEGER                | NOT NULL DEFAULT NEXTVAL('x_id_seq'::regclass)
  13.  content | CHARACTER VARYING(255) | DEFAULT NULL::CHARACTER VARYING
  14. Indexes:
  15.     "x_pkey" PRIMARY KEY, btree (id)
  16.  
  17. postgres=# ALTER TABLE x RENAME TO y;
  18. ALTER TABLE
  19. postgres=# \d y
  20.                                  TABLE "public.y"
  21.  COLUMN  |          TYPE          |                   Modifiers                    
  22. ---------+------------------------+------------------------------------------------
  23.  id      | INTEGER                | NOT NULL DEFAULT NEXTVAL('x_id_seq'::regclass)
  24.  content | CHARACTER VARYING(255) | DEFAULT NULL::CHARACTER VARYING
  25. Indexes:
  26.     "x_pkey" PRIMARY KEY, btree (id)
Language: sql
Posted by Anonymous at 13 Oct 2011, 11:15:50 UTC