Re: create temp view from function inside plpgsql function.

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tjibbe Rijpma <tjibbe(at)rijpma(dot)org>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: create temp view from function inside plpgsql function.
Date: 2014-04-04 12:55:27
Message-ID: CAFj8pRCqFxpexXco8wF7vL2vNvJxDzUzpUH+=fnSrb52AJfcFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2014-04-04 14:16 GMT+02:00 Tjibbe <tjibbe(at)rijpma(dot)org>:

> Thanks that works!
>
> Little bit confusing ERROR.
>

yes, it could be - but hard to fix it, because it is based on cooperation
two worlds - plpgsql and SQL - and it is sometimes not simple.

When you understand how plpgsql interpret use variables in SQL queries,
then you understand to this message. Simple rule - never use plpgsql
variables in DDL

Regards

Pavel Stehule

>
> Regards
>
> Tjibbe
>
> --
> +31 6 29401726
> tjibbe(at)rijpma(dot)org
> Jacobusstraat 185
> 3012 JM Rotterdam
>
>
> On 4 April 2014 11:43, Tjibbe <tjibbe(at)rijpma(dot)org> wrote:
>
>> I have a plpgsql function with:
>>
>>
>> PERFORM * FROM answers(_h); --works fine.
>> CREATE TEMP VIEW answers AS SELECT * FROM answers(_h); --gives error...
>>
>> Why I get this error:
>> ERROR: column \"_h\" does not exist\nLINE 1: ...TEMP VIEW answers AS
>> SELECT * FROM antwoorden_view(_h)
>>
>> --
>> +31 6 29401726
>> tjibbe(at)rijpma(dot)org
>> Jacobusstraat 185
>> 3012 JM Rotterdam
>>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message François Beausoleil 2014-04-04 13:11:43 Re: Linux vs FreeBSD
Previous Message Thom Brown 2014-04-04 12:32:06 Re: hstore - jsonb