Обсуждение: restoring a backup and maintaining dependencies?
Hi again :) I have saved out these commands: CREATE TABLE group_items ( id serial NOT NULL, group_id integer, group_type text, item_id integer, visible integer, CONSTRAINT "group_items_PK" PRIMARYKEY (id) ) WITHOUT OIDS; ALTER TABLE group_items OWNER TO postgres; CREATE SEQUENCE group_items_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; ALTER TABLE group_items_id_seq OWNER TO postgres; If I restore them in pgadmin will they become dependent on each other in the same way as if I created the table in pgadmin? Or will they just become separate entities without any form of link? If that IS the case, how can I link them with SQL code, rather than pgadmin? Advice appreciated lots, I have a lot to learn here :| rob
There is no difference between running this script and using the pgadmin gui. pgadmin is just a front end to the database, it generates the same sql that you would write manually. If your table is group_items, name your sequence group_items_seq Laurent On 9/12/07, Robert Starr <rob@surrenderdorothy.com.au> wrote: > Hi again :) > > I have saved out these commands: > > CREATE TABLE group_items > ( > id serial NOT NULL, > group_id integer, > group_type text, > item_id integer, > visible integer, > CONSTRAINT "group_items_PK" PRIMARY KEY (id) > ) > WITHOUT OIDS; > ALTER TABLE group_items OWNER TO postgres; > > > CREATE SEQUENCE group_items_id_seq > INCREMENT 1 > MINVALUE 1 > MAXVALUE 9223372036854775807 > START 1 > CACHE 1; > ALTER TABLE group_items_id_seq OWNER TO postgres; > > > If I restore them in pgadmin will they become dependent on each other in > the same way as if I created the table in pgadmin? Or will they just > become separate entities without any form of link? If that IS the case, > how can I link them with SQL code, rather than pgadmin? > > Advice appreciated lots, I have a lot to learn here :| > > rob > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend >
Thank you so much, I wondered that. Seemed over simple ;) as I thought there must be an explicit link rather than a naming convention.
:) Thanks again.
:) Thanks again.
Rob
Laurent Yaish wrote:
There is no difference between running this script and using the pgadmin gui. pgadmin is just a front end to the database, it generates the same sql that you would write manually. If your table is group_items, name your sequence group_items_seq Laurent On 9/12/07, Robert Starr <rob@surrenderdorothy.com.au> wrote:Hi again :) I have saved out these commands: CREATE TABLE group_items ( id serial NOT NULL, group_id integer, group_type text, item_id integer, visible integer, CONSTRAINT "group_items_PK" PRIMARY KEY (id) ) WITHOUT OIDS; ALTER TABLE group_items OWNER TO postgres; CREATE SEQUENCE group_items_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; ALTER TABLE group_items_id_seq OWNER TO postgres; If I restore them in pgadmin will they become dependent on each other in the same way as if I created the table in pgadmin? Or will they just become separate entities without any form of link? If that IS the case, how can I link them with SQL code, rather than pgadmin? Advice appreciated lots, I have a lot to learn here :| rob ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend