On Thu, Jun 20, 2013 at 12:34 PM, Amit Langote <amitlangote09@gmail.com> wrote:
> On Thu, Jun 20, 2013 at 11:10 AM, Chris Angelico <rosuav@gmail.com> wrote:
>> On Thu, Jun 20, 2013 at 12:09 PM, Amit Langote <amitlangote09@gmail.com> wrote:
>>> Umm, my bad! I almost forgot I could write pure SQL function bodies.
>>> Although, why does following happen? (sorry, a 8.4.2 installation) :
>>>
>>> postgres=# create or replace function gt(n int, m int) returns boolean
>>> as 'select n>m' language sql;
>>> ERROR: column "n" does not exist
>>> LINE 2: as 'select n>m' language sql;
>>
>> Hmm, no idea. I'm using 9.2.4, could well have been changes.
>>
>
> Hmm, I guess in 8.4.2, one needs to refer to function arguments as $1, $2 ...
Ah, okay. I'm not all that familiar with different versions of
PostgreSQL; I used it first back in the 1990s, then didn't use it for
years (was all DB2), and now picked it up again at version 9.0/9.1,
moving to 9.2 when it came out.
> And yes. OP can go ahead with his migration using this suggested
> wrapping function idea.
Absolutely!
ChrisA