pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Creating a new type
2+ messages / 2 participants
[nested] [flat]

* Creating a new type
@ 2006-06-28 14:49  Rodrigo Sakai <rodrigo.sakai@zanthus.com.br>
  0 siblings, 1 reply; 2+ messages in thread

From: Rodrigo Sakai @ 2006-06-28 14:49 UTC (permalink / raw)
  To: pgsql-interfaces

  Hi all,

 

  I have to create a new composed data type to use in almost all tables of
my database. Something like:

 

  CREATE TYPE time_interval (

    Tbegin date,

    Tend date

   ) 

 

 

  And when use this new type in my tables! So, I have to be able to get the
table_name or table_id that the type is in. For exemple:

 

  CREATE TABLE employee (

    Emp_id int,

    Emp_name varchar(30),

    Emp_time time_interval

  )

 

  So, when I execute an INSERT operation on this table, the functions that
deals with this type need the id or name of the table that the data was
inserted!

  How can I get this ID or NAME inside this functions??? 

 

  Thanks!!!

 

 

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

* Re: Creating a new type
@ 2006-06-28 14:59  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Rodrigo Sakai <rodrigo.sakai@zanthus.com.br>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2006-06-28 14:59 UTC (permalink / raw)
  To: rodrigo.sakai@zanthus.com.br; +Cc: pgsql-interfaces

"Rodrigo Sakai" <rodrigo.sakai@zanthus.com.br> writes:
>   So, when I execute an INSERT operation on this table, the functions that
> deals with this type need the id or name of the table that the data was
> inserted!

Why?  Your example datatype doesn't seem to require any such thing.

>   How can I get this ID or NAME inside this functions??? 

You can't.  The question itself is bogus because it assumes that data
values only exist within tables.  You could not have a transient value
of the datatype (eg, a function result) because that is not stored in
any table.

			regards, tom lane



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


end of thread, other threads:[~2006-06-28 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-06-28 14:49 Creating a new type Rodrigo Sakai <rodrigo.sakai@zanthus.com.br>
2006-06-28 14:59 ` Tom Lane <tgl@sss.pgh.pa.us>

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