[TinyOWS-users] tinyows with views

Marc-André Trottier marcandre_trottier at hotmail.com
Thu Nov 3 10:15:10 EST 2011


i mentionned my problem to a coworker and he gave me this SQL to get the
primary key's name either a table or a view.

SELECT column_name  FROM information_schema.view_table_usage vtu
JOIN information_schema.constraint_column_usage ccu ON vtu.table_name =
ccu.table_name
JOIN pg_constraint c ON c.conname=ccu.constraint_name
WHERE vtu.view_name = 'table_or_view_name'
AND c.contype='p'
UNION
SELECT column_name  FROM information_schema.constraint_column_usage ccu
JOIN pg_constraint c ON c.conname=ccu.constraint_name
WHERE ccu.table_name = 'table_or_view_name'
AND c.contype='p'

I wondered if this could replace the current SQL to get the primary key's
name or it will cause problems elsewhere ?


Marc-André Trottier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/tinyows-users/attachments/20111103/47e572c3/attachment.htm 


More information about the TinyOWS-users mailing list