mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-21 03:13:05 +08:00
Very small changes in the contrib's pg_dumplo in the attache.
And: Note, Bruce I found in the contrib tree any files that we forget remove during contrib cleaning. Please remove these files: contrib/lo/test.sql contrib/pg_dumplo/Makefile.out contrib/pgbench/pgbench_jis.doc contrib/spi/new_example.example contrib/spi/README.MAX Thanks. Karel
This commit is contained in:
parent
efcff3da16
commit
d66a8c7c47
@ -9,11 +9,10 @@ this help or the cool HOWTO.
|
||||
|
||||
Compilation:
|
||||
~~~~~~~~~~~
|
||||
- In the PG contrib tree:
|
||||
* run master ./configure in the PG source top directory
|
||||
* run 'make'
|
||||
* run 'make install'
|
||||
|
||||
|
||||
THANKS:
|
||||
~~~~~~
|
||||
<??? I lost his e-mail ???>
|
||||
|
@ -104,7 +104,7 @@ pglo_export(LODumpMaster *pgLO)
|
||||
if ((tuples = PQntuples(pgLO->res)) == 0) {
|
||||
|
||||
if (!pgLO->quiet && pgLO->action == ACTION_EXPORT_ATTR)
|
||||
printf("%s: not large objets in '%s'\n", progname, ll->lo_table);
|
||||
printf("%s: no large objets in '%s'\n", progname, ll->lo_table);
|
||||
continue;
|
||||
|
||||
} else if (check_res(pgLO)) {
|
||||
@ -137,7 +137,7 @@ pglo_export(LODumpMaster *pgLO)
|
||||
}
|
||||
|
||||
if (!pgLO->quiet)
|
||||
printf("dump %s.%s (%d lagre obj)\n",
|
||||
printf("dump %s.%s (%d large obj)\n",
|
||||
ll->lo_table, ll->lo_attr, tuples);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.2 2000/06/19 13:54:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.3 2000/07/03 16:03:22 momjian Exp $
|
||||
*
|
||||
* Karel Zak 1999-2000
|
||||
* -------------------------------------------------------------------------
|
||||
@ -85,6 +85,7 @@ main(int argc, char **argv)
|
||||
{ "host", required_argument, 0, 'h' },
|
||||
{ "space", required_argument, 0, 's' },
|
||||
{ "import", no_argument, 0, 'i' },
|
||||
{ "export", no_argument, 0, 'e' },
|
||||
{ "remove", no_argument, 0, 'r' },
|
||||
{ "quiet", no_argument, 0, 'q' },
|
||||
{ "all", no_argument, 0, 'a' },
|
||||
|
@ -1,68 +0,0 @@
|
||||
--Column ID of table A is primary key:
|
||||
|
||||
CREATE TABLE A (
|
||||
ID int4 not null,
|
||||
id1 int4 not null,
|
||||
primary key (ID,ID1)
|
||||
);
|
||||
|
||||
--Columns REFB of table B and REFC of C are foreign keys referenting ID of A:
|
||||
|
||||
CREATE TABLE B (
|
||||
REFB int4,
|
||||
REFB1 INT4
|
||||
);
|
||||
CREATE INDEX BI ON B (REFB);
|
||||
|
||||
CREATE TABLE C (
|
||||
REFC int4,
|
||||
REFC1 int4
|
||||
);
|
||||
CREATE INDEX CI ON C (REFC);
|
||||
|
||||
--Trigger for table A:
|
||||
|
||||
CREATE TRIGGER AT BEFORE DELETE ON A FOR EACH ROW
|
||||
EXECUTE PROCEDURE
|
||||
check_foreign_key (2, 'cascade', 'ID','id1', 'B', 'REFB','REFB1', 'C', 'REFC','REFC1');
|
||||
|
||||
|
||||
CREATE TRIGGER AT1 AFTER UPDATE ON A FOR EACH ROW
|
||||
EXECUTE PROCEDURE
|
||||
check_foreign_key (2, 'cascade', 'ID','id1', 'B', 'REFB','REFB1', 'C', 'REFC','REFC1');
|
||||
|
||||
|
||||
CREATE TRIGGER BT BEFORE INSERT OR UPDATE ON B FOR EACH ROW
|
||||
EXECUTE PROCEDURE
|
||||
check_primary_key ('REFB','REFB1', 'A', 'ID','ID1');
|
||||
|
||||
CREATE TRIGGER CT BEFORE INSERT OR UPDATE ON C FOR EACH ROW
|
||||
EXECUTE PROCEDURE
|
||||
check_primary_key ('REFC','REFC1', 'A', 'ID','ID1');
|
||||
|
||||
|
||||
|
||||
-- Now try
|
||||
|
||||
INSERT INTO A VALUES (10,10);
|
||||
INSERT INTO A VALUES (20,20);
|
||||
INSERT INTO A VALUES (30,30);
|
||||
INSERT INTO A VALUES (40,41);
|
||||
INSERT INTO A VALUES (50,50);
|
||||
|
||||
INSERT INTO B VALUES (1); -- invalid reference
|
||||
INSERT INTO B VALUES (10,10);
|
||||
INSERT INTO B VALUES (30,30);
|
||||
INSERT INTO B VALUES (30,30);
|
||||
|
||||
INSERT INTO C VALUES (11); -- invalid reference
|
||||
INSERT INTO C VALUES (20,20);
|
||||
INSERT INTO C VALUES (20,21);
|
||||
INSERT INTO C VALUES (30,30);
|
||||
|
||||
-- now update work well
|
||||
update A set ID = 100 , ID1 = 199 where ID=30 ;
|
||||
|
||||
SELECT * FROM A;
|
||||
SELECT * FROM B;
|
||||
SELECT * FROM C;
|
Loading…
Reference in New Issue
Block a user