%TYPE

From: Ged <pgsql4gm(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: %TYPE
Date: 2007-08-23 02:42:24
Message-ID: 65ca86740708221942u57477844x52772e68fc38f38@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Checking out a bug in my code I find in my table definition:

CREATE TABLE publications
(
...
name character varying(60) NOT NULL,
...
);

while in the function I use to populate the web page, which
amalgamates info from several sources, I have:

CREATE TYPE npc_page_details_type AS
(
...
instance_name character varying(40),
...
);

(where instances inherits name from publications). In other words, I
changed one definition and forgot to change the other.

I've been looking to see if postgresql allows type definitions like
the ones I'm used to from Oracle, where I can say:

CREATE TYPE npc_page_details_type AS
(
...
instance_name instances.name%type,
...
);

and it will pick up the current type of instances.name when the user
type gets compiled. However I haven't been able to find anything. Is
anything like that available? Or should I just update my definitions
and grit my teeth and carry on?

Cheers,
G.

Responses

  • Re: %TYPE at 2007-08-23 04:00:41 from Michael Glaesemann
  • Re: %TYPE at 2007-08-23 12:57:00 from Richard Huxton

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Amiel 2007-08-23 02:44:25 pg_dump causes postgres crash
Previous Message Joshua D. Drake 2007-08-23 01:09:35 Re: reporting tools