Need for advice and direction (again)

From: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
To: <tgl(at)postgresql(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Need for advice and direction (again)
Date: 2007-11-10 00:37:01
Message-ID: 00b101c82331$cf3c62f0$0a01a8c0@gevmus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Tom,

I would like to know your opinion about the way we should refer to composite
type params in functions.
For example:

CREATE TABLE emp (
name text,
salary numeric,
age integer,
cubicle point
);

CREATE FUNCTION double_salary(emp) RETURNS numeric AS $$
SELECT $1.salary * 2 AS salary;
$$ LANGUAGE SQL;

How should we refer to emp in the following example.

CREATE FUNCTION double_salary(PARAM1 emp) RETURNS numeric AS $$

-- At this moment PARAM1.salary will fail because PARAM1
-- is compared to the name of this function
SELECT PARAM1.salary * 2 AS salary;

-- Would this be correct?
SELECT double_salary.PARAM1.salary * 2 AS salary;

$$ LANGUAGE SQL;

Regards,
Gevik.

------------------------------------------------
Gevik Babakhani

PostgreSQL NL http://www.postgresql.nl
TrueSoftware BV http://www.truesoftware.nl
------------------------------------------------

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-11-10 00:38:08 Re: Segmentation fault using digest from pg_crypto
Previous Message Jacques Caron 2007-11-10 00:34:29 autovacuum_freeze_max_age