Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ccca223b
Commit
ccca223b
authored
Mar 13, 2001
by
Philip Warner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Use subselect when enabling triggers,
- Use exact table names when enabling/disabling triggers
parent
e376cb60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
21 deletions
+5
-21
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+5
-21
No files found.
src/bin/pg_dump/pg_backup_archiver.c
View file @
ccca223b
...
@@ -420,7 +420,7 @@ static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, Restore
...
@@ -420,7 +420,7 @@ static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, Restore
*/
*/
if
(
te
&&
te
->
name
&&
strlen
(
te
->
name
)
>
0
)
if
(
te
&&
te
->
name
&&
strlen
(
te
->
name
)
>
0
)
ahprintf
(
AH
,
"UPDATE
\"
pg_class
\"
SET
\"
reltriggers
\"
= 0 WHERE
\"
relname
\"
~* '%s';
\n
"
,
ahprintf
(
AH
,
"UPDATE
\"
pg_class
\"
SET
\"
reltriggers
\"
= 0 WHERE
\"
relname
\"
= '%s';
\n
\n
"
,
te
->
name
);
te
->
name
);
else
else
ahprintf
(
AH
,
"UPDATE
\"
pg_class
\"
SET
\"
reltriggers
\"
= 0 WHERE
\"
relname
\"
!~ '^pg_';
\n\n
"
);
ahprintf
(
AH
,
"UPDATE
\"
pg_class
\"
SET
\"
reltriggers
\"
= 0 WHERE
\"
relname
\"
!~ '^pg_';
\n\n
"
);
...
@@ -471,26 +471,10 @@ static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreO
...
@@ -471,26 +471,10 @@ static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreO
* command when one is available.
* command when one is available.
*/
*/
ahprintf
(
AH
,
"-- Enable triggers
\n
"
);
ahprintf
(
AH
,
"-- Enable triggers
\n
"
);
ahprintf
(
AH
,
"BEGIN TRANSACTION;
\n
"
);
ahprintf
(
AH
,
"UPDATE pg_class SET reltriggers = "
ahprintf
(
AH
,
"CREATE TEMP TABLE
\"
tr
\"
(
\"
tmp_relname
\"
name,
\"
tmp_reltriggers
\"
smallint);
\n
"
);
"(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) "
"WHERE relname = '%s';
\n\n
"
,
/*
te
->
name
);
* Just update the affected table, if known.
*/
if
(
te
&&
te
->
name
&&
strlen
(
te
->
name
)
>
0
)
ahprintf
(
AH
,
"INSERT INTO
\"
tr
\"
SELECT C.
\"
relname
\"
, count(T.
\"
oid
\"
) FROM
\"
pg_class
\"
C,"
"
\"
pg_trigger
\"
T WHERE C.
\"
oid
\"
= T.
\"
tgrelid
\"
AND C.
\"
relname
\"
~* '%s' "
" GROUP BY 1;
\n
"
,
te
->
name
);
else
ahprintf
(
AH
,
"INSERT INTO
\"
tr
\"
SELECT C.
\"
relname
\"
, count(T.
\"
oid
\"
) FROM
\"
pg_class
\"
C,"
"
\"
pg_trigger
\"
T WHERE C.
\"
oid
\"
= T.
\"
tgrelid
\"
AND C.
\"
relname
\"
!~ '^pg_' "
" GROUP BY 1;
\n
"
);
ahprintf
(
AH
,
"UPDATE
\"
pg_class
\"
SET
\"
reltriggers
\"
= TMP.
\"
tmp_reltriggers
\"
"
"FROM
\"
tr
\"
TMP WHERE "
"
\"
pg_class
\"
.
\"
relname
\"
= TMP.
\"
tmp_relname
\"
;
\n
"
);
ahprintf
(
AH
,
"DROP TABLE
\"
tr
\"
;
\n
"
);
ahprintf
(
AH
,
"COMMIT TRANSACTION;
\n\n
"
);
/*
/*
* Restore the user connection from the start of this procedure
* Restore the user connection from the start of this procedure
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment