pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anibal David Acosta <anibal.acosta@edge.com.py>
To: 'Julius Tuskenis' <julius@nsoft.lt>
To: pgsql-admin@postgresql.org
Subject: Re: insert in function writen in pgplsql
Date: Fri, 19 Mar 2010 11:00:34 -0400
Message-ID: <000f01cac774$f2d17ef0$d8747cd0$@net.py> (raw)
In-Reply-To: <4BA37FF5.8060001@nsoft.lt>
References: <4BA37FF5.8060001@nsoft.lt>

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 
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


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin




view thread (9+ messages)  latest in thread

Message-ID: <000f01cac774$f2d17ef0$d8747cd0$@net.py>
Permalink:  ../000f01cac774$f2d17ef0$d8747cd0$@net.py/
Also on:    postgresql.org/message-id/000f01cac774$f2d17ef0$d8747cd0$@net.py

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: anibal.acosta@edge.com.py, julius@nsoft.lt
  Subject: Re: insert in function writen in pgplsql
  In-Reply-To: <000f01cac774$f2d17ef0$d8747cd0$@net.py>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox