Skip to content

Instantly share code, notes, and snippets.

@posulliv
Created April 7, 2009 04:09
Show Gist options
  • Save posulliv/91094 to your computer and use it in GitHub Desktop.
Save posulliv/91094 to your computer and use it in GitHub Desktop.
padraig=# \d t1;
Table "public.t1"
Column | Type | Modifiers
--------+------------------------+-----------
id | integer | not null
text | character varying(255) | not null
Indexes:
"t1_pkey" PRIMARY KEY, btree (id)
padraig=# select * from t1;
id | text
----+--------------------------
1 | this is the first entry
2 | this is the second entry
3 | this is the third value
(3 rows)
padraig=# \d t2;
Table "public.t2"
Column | Type | Modifiers
--------+------------------------+-----------
id | integer |
text | character varying(255) | not null
Foreign-key constraints:
"t2_id_fkey" FOREIGN KEY (id) REFERENCES t1(id)
padraig=# select * from t2;
id | text
----+----------------------
1 | this is related to 1
1 | this is related to 1
1 | this is related to 1
3 | this is related to 3
(4 rows)
padraig=#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment