CREATE TABLE - DEFAULT

From: Ingrith Andrea Correa Vargas <i-correa(at)uniandes(dot)edu(dot)co>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: CREATE TABLE - DEFAULT
Date: 1999-02-27 21:35:23
Message-ID: Pine.GSO.3.96.990227163049.9899A-100000@isis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello again!

I have been receiving some mails asking my question about creating a table
with a default value as a user defined function, but I have a problem yet.

I hope somebody knows to solve my problem...
Thank you in advance! :)

//Ingrith

---||---

Te complete problem is:

---------------------------------------------------------
CREATE TABLE emp (code INT4
, name VARCHAR(20)
, salary INT4
, 2salary INT4 default double_salary(emp)
);

CREATE FUNCTION double_salary(emp) RETURNS INT4
AS 'SELECT $1.salay * 2 AS result' LANGUAGE 'sql'
;

ERROR: parser: syntax error at or near ")"
---------------------------------------------------------

Function double_salary receives an 'emp' , as you see, and there is the
error, because if I change parameter 'emp' by a number, the error doesn't
appear.

How can I do?!

The origin of this question is that I want to know if a subclass inherits
all atributtes from the parent, included functions like double_salary in
my example.

Browse pgsql-sql by date

  From Date Subject
Next Message archiver 1999-02-27 22:50:40 Simple Question??
Previous Message Mauricio Carvalho de Oliveira 1999-02-27 15:00:32 Re: Trying to concatenate using a string variable and text