%TYPE - Mailing list pgsql-general

From Ged
Subject %TYPE
Date
Msg-id 65ca86740708221942u57477844x52772e68fc38f38@mail.gmail.com
Whole thread Raw
Responses Re: %TYPE  (Michael Glaesemann <grzm@seespotcode.net>)
List 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.

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: reporting tools
Next
From: Jeff Amiel
Date:
Subject: pg_dump causes postgres crash