Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id A660F641C11 for ; Fri, 19 Mar 2010 10:45:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 59547-08-3 for ; Fri, 19 Mar 2010 13:45:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.csc.lt (mail.csc.lt [193.138.191.5]) by mail.postgresql.org (Postfix) with ESMTP id 2FEEA641D4A for ; Fri, 19 Mar 2010 10:45:31 -0300 (ADT) Received: (qmail 2874 invoked by uid 210); 19 Mar 2010 13:45:27 -0000 Received: from mail.nsoft.lt by mail.csc.lt (envelope-from , uid 201) with qmail-scanner-2.05st (clamdscan: 0.95.3/10595. spamassassin: 3.2.1. perlscan: 2.05st. Clear:RC:1(77.240.249.53):. Processed in 0.011482 secs); 19 Mar 2010 13:45:27 -0000 Received: from mail.nsoft.lt (77.240.249.53) by mail.csc.lt with SMTP; 19 Mar 2010 13:45:27 -0000 Received: from [192.168.16.103] (unknown [77.240.249.53]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.nsoft.lt (Postfix) with ESMTPS id D4FE78E045 for ; Fri, 19 Mar 2010 14:59:35 +0200 (EET) Message-ID: <4BA37FF5.8060001@nsoft.lt> Date: Fri, 19 Mar 2010 15:45:25 +0200 From: Julius Tuskenis Organization: UAB nSoft User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; lt; rv:1.9.1.8) Gecko/20100227 Lightning/1.0b1 Thunderbird/3.0.3 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: insert in function writen in pgplsql Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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/139 X-Sequence-Number: 33938 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? using PG 8.3 -- Julius Tuskenis Programavimo skyriaus vadovas UAB nSoft mob. +37068233050