Constraint using a SQL function executed during SELECT
От | Cyril B. |
---|---|
Тема | Constraint using a SQL function executed during SELECT |
Дата | |
Msg-id | 87d685b8-f61e-a2b6-06e2-b9e8f69c90be@excellency.fr обсуждение исходный текст |
Ответы |
Re: Constraint using a SQL function executed during SELECT
|
Список | pgsql-general |
Hello, Is there a way to execute a SELECT on a table having a constraint that uses a non-working SQL function? I know the easiest way would be to fix the function, but I'm the database administrator, not the owner, and I need to do a COUNT(*) on each table. Here's a minimal use case: CREATE TABLE t1 ( id integer ); CREATE SCHEMA rename_me; CREATE TABLE rename_me.t2 ( id integer ); CREATE FUNCTION f(id integer) RETURNS boolean LANGUAGE sql IMMUTABLE AS $_$ SELECT true FROM rename_me.t2 $_$; ALTER TABLE ONLY t1 ADD CONSTRAINT c EXCLUDE (id WITH =) WHERE ((f(id) IS NOT TRUE)); ALTER SCHEMA rename_me RENAME TO renamed; SELECT * FROM "t1"; returns: ERROR: relation "rename_me.t2" does not exist LINE 3: FROM rename_me.t2 ^ QUERY: SELECT true FROM rename_me.t2 CONTEXT: SQL function "f" during inlining Tested on 9.5.2 (and an older 9.0). -- Cyril B.
В списке pgsql-general по дате отправления: