From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | marian krucina <marian(dot)krucina(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Dump/restore indexes and functions in public schema |
Date: | 2012-10-09 14:51:13 |
Message-ID: | 11802.1349794273@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
marian krucina <marian(dot)krucina(at)gmail(dot)com> writes:
> Example:
> in PG91:
> CREATE FUNCTION function_y(x INT) RETURNS INT AS $$ SELECT $1*$1 $$
> LANGUAGE SQL;
> CREATE FUNCTION function_x(x INT) RETURNS INT AS $$ SELECT
> function_y($1) $$ LANGUAGE SQL;
> CREATE SCHEMA schema_a;
> CREATE TABLE schema_a.table_a(i INT);
> CREATE INDEX ON schema_a.table_a(function_x(i));
> INSERT INTO schema_a.table_a VALUES(1),(9),(2);
Mph. Well, actually what you've got there is a function that will break
anytime somebody looks at it sideways, anyhow. You need to
schema-qualify the reference to function_y, or if you don't want to do
that for some reason, you could attach a "SET search_path" clause to the
definition of function_x.
I don't regard this as a Postgres bug, because index functions are
required to be immutable, and function_x fails that test because its
results vary depending on search_path.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Matthijs Möhlmann | 2012-10-09 14:55:50 | plpgsql: trigger insert new into other table (archive) |
Previous Message | Willy-Bas Loos | 2012-10-09 13:54:35 | Re: something better than pgtrgm? |