looking up field names

Поиск
Список
Период
Сортировка
Искать

looking up field names

От:
terry@greatgulfhomes.com
Дата:
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 = ''
    AND pg_class.reltype = pg_attribute.attrelid
    AND pg_attribute.attname = ''

Thanks in advance

Terry Fielder
Network Engineer
Great Gulf Homes / Ashton Woods Homes
terry@greatgulfhomes.com

Re: looking up field names

От:
Robert Treat <rtreat@webmd.net>
Дата:
try

SELECT count(1)
FROM    pg_class c, pg_attribute a
WHERE   c.relname = ''
    AND a.attrelid = c.oid 
    AND a.attname = ''

hth

Robert Treat

On Fri, 2002-07-12 at 16:42, terry@greatgulfhomes.com wrote:
> 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 = '
' > AND pg_class.reltype = pg_attribute.attrelid > AND pg_attribute.attname = '' > > Thanks in advance > > Terry Fielder > Network Engineer > Great Gulf Homes / Ashton Woods Homes > terry@greatgulfhomes.com > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
FAQ