suhas.basavaraj12
2012-11-28 05:37:05 UTC
Hi,
Found a peculiar issue with reorg_trigger on one of the important table
in the db.
SELECT>ERROR: must be superuser to use reorg_trigger function.
Due to this , table was not accessible by application and all the stored
procedures which run on that table failed.
I did \d affected_table , but that trigger was not there on that table .But
when i searched in schema i found below trigger
CREATE FUNCTION conflicted_triggers(oid) RETURNS SETOF name
LANGUAGE sql STABLE STRICT
AS $_$
SELECT tgname FROM pg_trigger
WHERE tgrelid = $1 AND tgname >= 'z_reorg_trigger'
$_$;
CREATE FUNCTION get_create_trigger(relid oid, pkid oid) RETURNS text
LANGUAGE sql STABLE STRICT
AS $_$
SELECT 'CREATE TRIGGER z_reorg_trigger' ||
' BEFORE INSERT OR DELETE OR UPDATE ON ' || reorg.oid2text($1) ||
' FOR EACH ROW EXECUTE PROCEDURE reorg.reorg_trigger(' ||
'''INSERT INTO reorg.log_' || $1 || '(pk, row) VALUES(' ||
' CASE WHEN $1 IS NULL THEN NULL ELSE (ROW($1.' ||
reorg.get_index_columns($2, ', $1.') || ')::reorg.pk_' ||
$1 || ') END, $2)'')';
$_$;
CREATE TRIGGER z_reorg_trigger BEFORE INSERT OR DELETE OR UPDATE ON
AFFECTED_TABLE
FOR EACH ROW EXECUTE PROCEDURE reorg.reorg_trigger('INSERT INTO
reorg.log_16793623(pk, row)
VALUES( CASE WHEN $1 IS NULL THEN NULL ELSE
(ROW($1.sequence_id)::reorg.pk_16793623) END, $2)');
CREATE FUNCTION reorg_trigger() RETURNS trigger
LANGUAGE c STRICT SECURITY DEFINER
AS '$libdir/pg_reorg', 'reorg_trigger';
when i checked this belonged to pg_reorg, but i do not understand why this
error was coming
Rgrds
Suhas
--
View this message in context: http://postgresql.1045698.n5.nabble.com/PG-REORG-ISSUE-tp5733850.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
Found a peculiar issue with reorg_trigger on one of the important table
in the db.
SELECT>ERROR: must be superuser to use reorg_trigger function.
Due to this , table was not accessible by application and all the stored
procedures which run on that table failed.
I did \d affected_table , but that trigger was not there on that table .But
when i searched in schema i found below trigger
CREATE FUNCTION conflicted_triggers(oid) RETURNS SETOF name
LANGUAGE sql STABLE STRICT
AS $_$
SELECT tgname FROM pg_trigger
WHERE tgrelid = $1 AND tgname >= 'z_reorg_trigger'
$_$;
CREATE FUNCTION get_create_trigger(relid oid, pkid oid) RETURNS text
LANGUAGE sql STABLE STRICT
AS $_$
SELECT 'CREATE TRIGGER z_reorg_trigger' ||
' BEFORE INSERT OR DELETE OR UPDATE ON ' || reorg.oid2text($1) ||
' FOR EACH ROW EXECUTE PROCEDURE reorg.reorg_trigger(' ||
'''INSERT INTO reorg.log_' || $1 || '(pk, row) VALUES(' ||
' CASE WHEN $1 IS NULL THEN NULL ELSE (ROW($1.' ||
reorg.get_index_columns($2, ', $1.') || ')::reorg.pk_' ||
$1 || ') END, $2)'')';
$_$;
CREATE TRIGGER z_reorg_trigger BEFORE INSERT OR DELETE OR UPDATE ON
AFFECTED_TABLE
FOR EACH ROW EXECUTE PROCEDURE reorg.reorg_trigger('INSERT INTO
reorg.log_16793623(pk, row)
VALUES( CASE WHEN $1 IS NULL THEN NULL ELSE
(ROW($1.sequence_id)::reorg.pk_16793623) END, $2)');
CREATE FUNCTION reorg_trigger() RETURNS trigger
LANGUAGE c STRICT SECURITY DEFINER
AS '$libdir/pg_reorg', 'reorg_trigger';
when i checked this belonged to pg_reorg, but i do not understand why this
error was coming
Rgrds
Suhas
--
View this message in context: http://postgresql.1045698.n5.nabble.com/PG-REORG-ISSUE-tp5733850.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin