Re: INSERT INTO foo (col1,col2,...,coln) not working

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Juan Francisco Diaz <j-diaz(at)publicar(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: INSERT INTO foo (col1,col2,...,coln) not working
Date: 2003-08-26 06:03:12
Message-ID: 20030825230040.B16064-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, 25 Aug 2003, Juan Francisco Diaz wrote:

> Why does this statement:
>
> insert into Topos (IdLibro, Pagina, IdTopo, IdReferencia, PosX, PosY, Ancho, Alto) values
> (CAST(Libro AS CHAR(6)), pag, CAST(Topo As CHAR(6)), CAST(Refe AS CHAR(6)), posX,
> posY, Ancho, Alto);
>
> gives me this error (the statement is on line 16 of a function, all aliases are ok):
>
> WARNING: Error occurred while executing PL/pgSQL function instopo
> WARNING: line 16 at SQL statement
> ERROR: parser: parse error at or near "$1" at character 60

At least Ancho and Alto appear to be being used both as column names and
variable names. You probably need to make sure that the variables don't
exactly match the column names (otherwise the substitutions will be done
in the column list iirc).

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andreas Fromm 2003-08-26 12:23:08 where to find list of special words
Previous Message Stephan Szabo 2003-08-26 06:00:12 Re: Converting VARCHAR to DECIMAL or NUMERIC