BUG #14439: Trigger function fails with internal error after upgrade to 9.6
The following bug has been logged on the website:
Bug reference: 14439
Logged by: Maxim Valyanskiy
Email address: max.valjanski@gmail.com
PostgreSQL version: 9.6.1
Operating system: CentOS 6.8
Description:
Trigger function stopped working after upgrade from 9.5 to 9.6. Upgrade was
performed via pg_upgrade.
This is that error output:
# update ab_group set name='Domain Controllerz' where id=466;
ERROR: table row type and query-specified row type do not match
ПОДРОБНОСТИ: Query provides a value for a dropped column at ordinal
position 6.
КОНТЕКСТ: SQL statement "UPDATE ab_group SET name_gin =
to_tsvector('simple', NEW.name) WHERE id = NEW.id AND NEW.name <>
OLD.name"
PL/pgSQL function update_group_name_gin() line 4 at SQL statement
I tried to recreate function, made VACUUM FULL and CLUSTER for that table
and it did not fix the problem.
Here is source code for that function:
CREATE OR REPLACE FUNCTION public.update_group_name_gin()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
IF (TG_OP = 'UPDATE') THEN
UPDATE ab_group SET name_gin = to_tsvector('simple',
NEW.name) WHERE id = NEW.id AND NEW.name <> OLD.name;
RETURN NEW;
ELSIF (TG_OP = 'INSERT') THEN
UPDATE ab_group SET name_gin = to_tsvector('simple',
NEW.name) WHERE id = NEW.id;
END IF;
RETURN NULL;
END;
$function$
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
max.valjanski@gmail.com writes:
# update ab_group set name='Domain Controllerz' where id=466;
ERROR: table row type and query-specified row type do not match
ПОДРОБНОСТИ: Query provides a value for a dropped column at ordinal
position 6.
КОНТЕКСТ: SQL statement "UPDATE ab_group SET name_gin =
to_tsvector('simple', NEW.name) WHERE id = NEW.id AND NEW.name <>
OLD.name"
PL/pgSQL function update_group_name_gin() line 4 at SQL statement
Wait a minute ... the trigger is issuing another UPDATE on its
own table? Aren't you risking an infinite recursion?
Could we see the result of
select attname,atttypid,attnum,attisdropped from pg_attribute
where attrelid = 'ab_group'::regclass order by attnum;
Also the exact definitions of all triggers and rules for that table.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
max.valjanski@gmail.com writes:
Trigger function stopped working after upgrade from 9.5 to 9.6. Upgrade was
performed via pg_upgrade.
After further thought I suspect this is the same issue discovered earlier
this month:
/messages/by-id/83shraampf.fsf@is-it.eu
There's a patch here:
https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=f4d865f22
If you're not prepared to rebuild with the patch, I think the only
short-term workaround is to recreate the table without a dropped
column.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs