Re: BUG #4860: Indexes gone after restore

From: "Obe, Regina" <robe(dot)dnd(at)cityofboston(dot)gov>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #4860: Indexes gone after restore
Date: 2009-06-18 18:33:39
Message-ID: 53F9CF533E1AA14EA1F8C5C08ABC08D204D7F38D@ZDND.DND.boston.cob
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> Hum. So the immediate problem is that st_transform() is failing to
> schema-qualify its reference to spatial_ref_sys. Think you need to
> be filing that one against PostGIS, not us.

Yah was sort of thinking that.

Though what about this -- isn't this case a bit more common

http://postgis.refractions.net/pipermail/postgis-users/2008-September/021393.html

If you have an index on a function that calls another function where the function being called does not have the namespace specifically prefixed.

In his example he had an index on ST_GeometryType (which calls the older function GeometryType both residing in the public schema)

So here is a more trivial example:

using your original

CREATE OR REPLACE FUNCTION foo(integer)
RETURNS integer AS
'select $1+1'
LANGUAGE 'sql' IMMUTABLE;

CREATE OR REPLACE FUNCTION foo2(integer)
RETURNS integer As
$$SELECT foo($1)$$
LANGUAGE 'sql' IMMUTABLE;

CREATE SCHEMA s1;
create table s1.t1 (f1 int);
create index i1 on s1.t1 (foo2(f1));

Try to back that up and then restore it.

error
pg_restore: [archiver (db)] Error from TOC entry 1769; 0 38023 TABLE DATA t1 pos
tgres
pg_restore: [archiver (db)] COPY failed: ERROR: function foo(integer) does not
exist
LINE 1: SELECT foo($1)
^
HINT: No function matches the given name and argument types. You might need to
add explicit type casts.
QUERY: SELECT foo($1)
CONTEXT: SQL function "foo2" during inlining
pg_restore: [archiver (db)] Error from TOC entry 1768; 1259 38029 INDEX i1 postg
res
pg_restore: [archiver (db)] could not execute query: ERROR: relation "i1" alrea
dy exists
Command was: CREATE INDEX i1 ON t1 USING btree (public.foo2(f1));
WARNING: errors ignored on restore: 32

Or do people not do this? I tend to a lot.

-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-06-18 18:43:58 Re: BUG #4860: Indexes gone after restore
Previous Message Tom Lane 2009-06-18 18:32:22 Re: BUG #4860: Indexes gone after restore