Re: insert in function writen in pgplsql - Mailing list pgsql-admin

From Guillaume Lelarge
Subject Re: insert in function writen in pgplsql
Date
Msg-id 4BA38833.60804@lelarge.info
Whole thread Raw
In response to insert in function writen in pgplsql  (Julius Tuskenis <julius@nsoft.lt>)
Responses Re: insert in function writen in pgplsql
List pgsql-admin
Le 19/03/2010 14:45, Julius Tuskenis a écrit :
> Hello
>
> lets say I have a function add_user(user varchar(20), password
> varchar(20)). In its body I want to have statement INSERT INTO
> my_users(user, password) VALUES (user, password); The problem is I cant
> - then I try to create such function I get "ERROR:  syntax error at or
> near "$1"
> LINE 1: INSERT INTO my_users(  $1 .... " This tells me the parameter is
> used instead of column name. That is of course not what I wanted. What
> would you recommend to fix this? Is there any way to tell the postgres
> that user is column name? I tried "user" with same error. Must I change
> the names of parameters?
>

Yes. It would also be easier to debug.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com

pgsql-admin by date:

Previous
From: Julius Tuskenis
Date:
Subject: insert in function writen in pgplsql
Next
From: Julius Tuskenis
Date:
Subject: Re: insert in function writen in pgplsql