Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 85E746335C2 for ; Fri, 19 Mar 2010 12:50:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 85302-08 for ; Fri, 19 Mar 2010 15:50:09 +0000 (UTC) X-Greylist: delayed 01:49:23.37922 by SQLgrey-1.7.6 Received: from mail-px0-f197.google.com (mail-px0-f197.google.com [209.85.216.197]) by mail.postgresql.org (Postfix) with ESMTP id E4D33632EA4 for ; Fri, 19 Mar 2010 12:50:09 -0300 (ADT) Received: by pxi35 with SMTP id 35so2551643pxi.19 for ; Fri, 19 Mar 2010 08:50:08 -0700 (PDT) Received: by 10.143.136.2 with SMTP id o2mr2047618wfn.189.1269007245604; Fri, 19 Mar 2010 07:00:45 -0700 (PDT) Received: from ANIBALVAIO ([200.85.62.34]) by mx.google.com with ESMTPS id j42sm129198ibr.19.2010.03.19.07.00.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 19 Mar 2010 07:00:44 -0700 (PDT) From: Anibal David Acosta To: "'Julius Tuskenis'" , References: <4BA37FF5.8060001@nsoft.lt> In-Reply-To: <4BA37FF5.8060001@nsoft.lt> Subject: Re: insert in function writen in pgplsql Date: Fri, 19 Mar 2010 11:00:34 -0400 Message-ID: <000f01cac774$f2d17ef0$d8747cd0$@net.py> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcrHaoxupTfxJBT4Sias6ralzH5hnAACj/VQ Content-Language: es-py X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/149 X-Sequence-Number: 33948 Try function add_user(_user varchar(20), _password varchar(20)) INSERT INTO my_users(user, password) VALUES (_user, _password); -----Mensaje original----- De: pgsql-admin-owner@postgresql.org = [mailto:pgsql-admin-owner@postgresql.org] En nombre de Julius Tuskenis Enviado el: viernes, 19 de marzo de 2010 09:45 a.m. Para: pgsql-admin@postgresql.org Asunto: [ADMIN] insert in function writen in pgplsql Hello lets say I have a function add_user(user varchar(20), password=20 varchar(20)). In its body I want to have statement INSERT INTO=20 my_users(user, password) VALUES (user, password); The problem is I cant=20 - then I try to create such function I get "ERROR: syntax error at or=20 near "$1" LINE 1: INSERT INTO my_users( $1 .... " This tells me the parameter is=20 used instead of column name. That is of course not what I wanted. What=20 would you recommend to fix this? Is there any way to tell the postgres=20 that user is column name? I tried "user" with same error. Must I change=20 the names of parameters? using PG 8.3 --=20 Julius Tuskenis Programavimo skyriaus vadovas UAB nSoft mob. +37068233050 --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin