looking up field names

From: terry(at)greatgulfhomes(dot)com
To: "Postgres (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: looking up field names
Date: 2002-07-12 20:42:54
Message-ID: 006001c229e4$b2dceae0$2766f30a@development.greatgulfhomes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am building a custom field engine. But I want to stop the user from
creating custom fields of the same name as a standard field in the table.

Would this suffice to find if a column already existed in a table:

SELECT count(*)
FROM pg_attribute, pg_class
WHERE pg_class.relname = '<table to check>'
AND pg_class.reltype = pg_attribute.attrelid
AND pg_attribute.attname = '<column name to check>'

Thanks in advance

Terry Fielder
Network Engineer
Great Gulf Homes / Ashton Woods Homes
terry(at)greatgulfhomes(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2002-07-12 21:20:53 Re: 7.2.1 optimises very badly against 7.2
Previous Message Jan Wieck 2002-07-12 20:39:55 Re: I am being interviewed by OReilly