pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6400: function arguments not accepted
3+ messages / 3 participants
[nested] [flat]

* BUG #6400: function arguments not accepted
@ 2012-01-18 13:38  knoch@ipa.fraunhofer.de
  0 siblings, 2 replies; 3+ messages in thread

From: knoch@ipa.fraunhofer.de @ 2012-01-18 13:38 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      6400
Logged by:          Sandra Knoch
Email address:      knoch@ipa.fraunhofer.de
PostgreSQL version: 9.0.6
Operating system:   Windows Server 2007 SP2
Description:        

I have a strange problem regarding functions with parameters. The parameters
are not accepted and I always get the error column "user" does not exist,
where user is the parameter name and not a column. The function looks like
this:

CREATE OR REPLACE FUNCTION tissue.insert_biopsy_data
(
  "user"          integer,
  in_date         date,
  in_description  varchar,
  in_weight       numeric,
  in_size         numeric
)
RETURNS integer AS
$$
declare
result integer;
begin
  INSERT INTO tissue.biopsy (id_biopsy, f_user,introduction_date,
description, weight, size)
  VALUES
  (
  DEFAULT,
  user,
  in_date,
  in_description,
  in_weight,
  in_size
  );
  SELECT id_biopsy FROM tissue.biopsy INTO result;
  Return result;
end
$$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;

It works with my old PostgreSQL 8.4 version, but not with the new one. What
is the problem here? Why is the argument not recognized as argument but as a
column name? Thank you for any help!





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6400: function arguments not accepted
@ 2012-01-18 23:39  bricklen <bricklen@gmail.com>
  parent: knoch@ipa.fraunhofer.de
  1 sibling, 0 replies; 3+ messages in thread

From: bricklen @ 2012-01-18 23:39 UTC (permalink / raw)
  To: knoch@ipa.fraunhofer.de; +Cc: pgsql-bugs

On Wed, Jan 18, 2012 at 5:38 AM,  <knoch@ipa.fraunhofer.de> wrote:
>  INSERT INTO tissue.biopsy (id_biopsy, f_user,introduction_date,
> description, weight, size)
>  VALUES
>  (
>  DEFAULT,
>  user,
>  in_date,
>  in_description,
>  in_weight,
>  in_size
>  );

What happens when you double-quote user in the insert statement?



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6400: function arguments not accepted
@ 2012-01-20 02:46  Robert Haas <robertmhaas@gmail.com>
  parent: knoch@ipa.fraunhofer.de
  1 sibling, 0 replies; 3+ messages in thread

From: Robert Haas @ 2012-01-20 02:46 UTC (permalink / raw)
  To: knoch@ipa.fraunhofer.de; +Cc: pgsql-bugs

On Wed, Jan 18, 2012 at 8:38 AM,  <knoch@ipa.fraunhofer.de> wrote:
> The following bug has been logged on the website:
>
> Bug reference:      6400
> Logged by:          Sandra Knoch
> Email address:      knoch@ipa.fraunhofer.de
> PostgreSQL version: 9.0.6
> Operating system:   Windows Server 2007 SP2
> Description:
>
> I have a strange problem regarding functions with parameters. The parameters
> are not accepted and I always get the error column "user" does not exist,
> where user is the parameter name and not a column. The function looks like
> this:
>
> CREATE OR REPLACE FUNCTION tissue.insert_biopsy_data
> (
>  "user"          integer,
>  in_date         date,
>  in_description  varchar,
>  in_weight       numeric,
>  in_size         numeric
> )
> RETURNS integer AS
> $$
> declare
> result integer;
> begin
>  INSERT INTO tissue.biopsy (id_biopsy, f_user,introduction_date,
> description, weight, size)
>  VALUES
>  (
>  DEFAULT,
>  user,
>  in_date,
>  in_description,
>  in_weight,
>  in_size
>  );
>  SELECT id_biopsy FROM tissue.biopsy INTO result;
>  Return result;
> end
> $$
> LANGUAGE 'plpgsql'
> VOLATILE
> CALLED ON NULL INPUT
> SECURITY INVOKER
> COST 100;
>
> It works with my old PostgreSQL 8.4 version, but not with the new one. What
> is the problem here? Why is the argument not recognized as argument but as a
> column name? Thank you for any help!

There were some changes in the way variable references are resolved in
PL/pgsql in version 9.0; unfortunately, you seem to have run across
one of the cases where the new behavior requires more quoting than the
old one did.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-01-20 02:46 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-01-18 13:38 BUG #6400: function arguments not accepted knoch@ipa.fraunhofer.de
2012-01-18 23:39 ` bricklen <bricklen@gmail.com>
2012-01-20 02:46 ` Robert Haas <robertmhaas@gmail.com>

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