Unix Technical Forum

=?iso-8859-1?Q?Re:_RE:__Finding_column_using_SQL_query=2E?=

This is a discussion on =?iso-8859-1?Q?Re:_RE:__Finding_column_using_SQL_query=2E?= within the pgsql Novice forums, part of the PostgreSQL category; --> You have to link like this: pg_attribute.attrelid=pg_class.oid and to find the datatye of an attribute: pg_attribute.atttypid=pg_type.oid HTH, Jürgen Rajan ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 08:29 PM
email@juergen-cappel.de
 
Posts: n/a
Default =?iso-8859-1?Q?Re:_RE:__Finding_column_using_SQL_query=2E?=


You have to link like this:

pg_attribute.attrelid=pg_class.oid

and to find the datatye of an attribute:

pg_attribute.atttypid=pg_type.oid



HTH, Jürgen




Rajan Bhide <rbhide@starentnetworks.com> schrieb am 09.02.2005,
12:10:54:
> I tried finding relation between pg_attribute and pg_class but seems
> there is no common key between these two table.
>
> select * from pg_attribute where attrelid = (select reltype from
> pg_class where relname = 'mytablename';
> attrelid | attname | atttypid | attstattarget | attlen | attnum |
> attndims | at
> tcacheoff | atttypmod | attbyval | attstorage | attisset | attalign |
> attnotnull
> | atthasdef
> ----------+---------+----------+---------------+--------+--------+------
> ----+---
> ----------+-----------+----------+------------+----------+----------+---
> --------
> -+-----------
> (0 rows)
>
>
> So this is not solving my problem.
> Am I missing somethg or there is some other way to find out?
> Plz comment.
>
> Thanks,
> Rajan
>
> -----Original Message-----
> From: email@juergen-cappel.de [mailto:email@juergen-cappel.de]
> Sent: Wednesday, February 09, 2005 3:38 PM
> To: Rajan Bhide
> Cc: pgsql-novice@postgresql.org
> Subject: Re: [NOVICE] Finding column using SQL query.
>
>
>
> Take a look at the system catalogs:
>
> http://www.postgresql.org/docs/8.0/i.../catalogs.html
>
> HTH
>
>
>
> Rajan Bhide schrieb am 09.02.2005,
> 10:56:20:
> > Hi,
> >
> > Is there any way to find whether a particular column exists in the
> > table or not based on the column name using sql query? I have a
> > requirement where I need to find whether a column exists in the table
> > or not using SQL query.
> >
> > Thanks,
> > Rajan
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 9: the planner will ignore your desire to choose an index scan if

> your
> > joining column's datatypes do not match


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:28 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com