Re: Stored procedures and relations

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: FET <bilaribilari(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Stored procedures and relations
Date: 2003-11-29 03:09:47
Message-ID: 20031128190810.J52057@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Fri, 28 Nov 2003, FET wrote:

> Hi everybody,
> I have a stored procedure that drops table A and then creates table A
> again. The table A has no constraints on any columns. When I execute
> the stored procedure by saying: SELECT sp_myproc(); It gives me an
> error saying : Relation 68428 does not exist.
>
> When I remove the CREATE FUNCTION and the stuff used to make it a
> stored procedure, and run the commands in the procedure, it works
> correctly.
>
> This behaviour is observed on all stored procedures on PG-SQL. I would
> really appreciate any help or interpretation of this error. By the
> way, the same stored procedure (with the syntax changed of course)
> works perfectly on MS SQL Server.

You haven't given too many details about what your function does, but, in
general if you're accessing a table whose structure is being dynamically
modified during/between calls, you'll currently want to be using EXECUTE
on queries relating to that table.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message George A.J 2003-11-29 03:20:21 Infinite loop crashes server
Previous Message Tomasz Myrta 2003-11-28 23:05:14 Re: explicit joins wrong planning