SQL function problem in 7.1?

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: "PostgreSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: SQL function problem in 7.1?
Date: 2001-02-09 15:09:26
Message-ID: 002f01c092aa$4e10e6c0$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am I doing something stupid with strings in SQL functions.

richardh=> select version();
version
------------------------------------------------------------------------
PostgreSQL 7.1beta3 on i586-pc-linux-gnu, compiled by GCC egcs-2.91.66
(1 row)

richardh=> select * from foo;
a | b
---+-----
1 | aaa
2 | bbb
3 | ccc
(3 rows)

richardh=> create function fooa(int) returns text as 'select b from foo
where a = $1;' language 'sql';
CREATE
richardh=> select fooa(2);
fooa
------
bbb
(1 row)

richardh=> create function foob(text) returns int as 'select a from foo
where b = ''$1'';' language 'sql';
CREATE
richardh=> select foob('bbb');
foob
------

(1 row)

TIA

- Richard Huxton

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lémery 2001-02-09 15:15:12 CopyObject Error 635
Previous Message Stephen Livesey 2001-02-09 13:39:56 PostgreSQL vs Oracle vs DB2 vs MySQL - Which should I use?