Re: check if type is valid pg type - Mailing list pgsql-novice

From Josh Kupershmidt
Subject Re: check if type is valid pg type
Date
Msg-id CAK3UJRHF5vA=VKxZhwVHdeQzNMPxXHpCMm86KgKyjtJurTf=nw@mail.gmail.com
Whole thread Raw
In response to check if type is valid pg type  (Dominik Moritz <domoritz@gmail.com>)
Responses Re: check if type is valid pg type
List pgsql-novice
On Mon, Oct 1, 2012 at 3:47 PM, Dominik Moritz <domoritz@gmail.com> wrote:
> I need to check, whether a type is a valid postgres type or not. My first take was to check in the pg_type table.
However,pg_type does not list types such as integer (but it does list int4) or float (but it does indeed list float8).
Whatis the best way to check whether a type is valid or not? 

You could cast the type name to regtype, e.g.

  SELECT 'integer'::regtype, 'float'::regtype;

Josh


pgsql-novice by date:

Previous
From: robert wing
Date:
Subject: selecting all tables with references
Next
From: James David Smith
Date:
Subject: Make UPDATE query quicker?