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.
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general