Re: plpgsql function errors

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: plpgsql function errors
Дата
Msg-id 20050204180617.GD14840@svana.org
обсуждение исходный текст
Ответ на plpgsql function errors  ("Juan Casero (FL FLC)" <Juan.Casero@wholefoods.com>)
Список pgsql-general
On Fri, Feb 04, 2005 at 11:40:50AM -0600, Juan Casero (FL FLC) wrote:
> Hi Everyone -
>
> I am new to this list and although I have been using postgresql on and
> off for about a year now.  I am trying to develop a webapp using perl
> and cgi with postgresql 7.4.6 as a backend database.  One of the things
> I need is to create a transactions table that will record a row of data
> and then return the transaction id to the caller.  I have decided to
> implement this piece of the webapp as a stored procedure in pl/pgsql.
> The following is the source code...

Firstly, I think you should look up the documentation for nextval(),
currval(). There is no possiblity of returning the wrong value even if
another transaction is running concurrently. And you don't need to lock
the table, which is good for performance.

<snip>

> # select
> trx_id(JUANCASERO3055128218,CREDIT,02/02/05,1,1,Aventura,02/01/05,Tom);
>
> I get the following error message
>
> ERROR:  column "juancasero3055128218" does not exist

You need to put those values into strings. Unless you do that it thinks
you're referring to a column named that. Try:

select trx_id('JUANCASERO3055128218','CREDIT','02/02/05',1,1,'Aventura','02/01/05','Tom');

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Questions about functionality
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Binding of "AS" vis "JOIN"