Re: checking data type

From: Chris <dmagick(at)gmail(dot)com>
To: raj <royuco77(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: checking data type
Date: 2006-03-30 01:08:34
Message-ID: 442B2F92.2070304@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

raj wrote:
> is there a function that could check for a variable's data type? like
> i want to check all the columns of a table and if i found a column with
> an integer data type i set it to a default 1 and i'll set a constant
> to a column of type text.

You could start psql with -E:

psql -d dbname -E

run \d <tablename>

and use the queries that postgres runs to work it out..

There could be a simpler way though in the system catalogues (anyone?).

I should ask why you need this info ;)

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message sylsau 2006-03-30 01:17:48 Use functions in Pl/Perl language
Previous Message Chris 2006-03-30 00:53:59 Re: weird GROUP BY error