pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
CREATE TABLE - DEFAULT
2+ messages / 1 participants
[nested] [flat]

* CREATE TABLE - DEFAULT
@ 1999-02-27 21:35 Ingrith Andrea Correa Vargas <i-correa@uniandes.edu.co>
  0 siblings, 0 replies; 2+ messages in thread

From: Ingrith Andrea Correa Vargas @ 1999-02-27 21:35 UTC (permalink / raw)
  To: 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.





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

* CREATE TABLE - DEFAULT
@ 1999-03-02 11:51 Ingrith Andrea Correa Vargas <i-correa@uniandes.edu.co>
  0 siblings, 0 replies; 2+ messages in thread

From: Ingrith Andrea Correa Vargas @ 1999-03-02 11:51 UTC (permalink / raw)
  To: pgsql-sql



I'll try sending my question again.
Can you help me?!

---------------------------------------------------------------------

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.






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


end of thread, other threads:[~1999-03-02 11:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-27 21:35 CREATE TABLE - DEFAULT Ingrith Andrea Correa Vargas <i-correa@uniandes.edu.co>
1999-03-02 11:51 CREATE TABLE - DEFAULT Ingrith Andrea Correa Vargas <i-correa@uniandes.edu.co>

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