Re: Syntax error at or near "$1"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ryan Booz <rxb19(at)psu(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Syntax error at or near "$1"
Date: 2004-04-29 20:23:43
Message-ID: 16442.1083270223@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ryan Booz <rxb19(at)psu(dot)edu> writes:
> I can't find any reason for the error below:

CVS tip gives a slightly more complete error message:

regression=# select list_devices('123456789012');
ERROR: syntax error at or near "$1" at character 30
QUERY: SELECT device_type_id FROM $1 WHERE mac_address = $2
CONTEXT: PL/pgSQL function "list_devices" line 7 at for over select rows
LINE 1: SELECT device_type_id FROM $1 WHERE mac_address = $2
^
regression=#

This might or might not help you figure out the problem: you used
"devices" as both a plpgsql variable name and a referenced table.
Pick another name for the variable.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Campano, Troy 2004-04-29 20:35:14 Re: Timestamp problems...wrong weeks.
Previous Message Andrew Rawnsley 2004-04-29 19:57:59 Re: postgresql idle