Issue 214 in dblinq2007: Getting constraint name from Postgres

2 views
Skip to first unread message

dblin...@googlecode.com

unread,
Mar 16, 2010, 11:57:59 AM3/16/10
to dblin...@googlegroups.com
Status: New
Owner: ----

New issue 214 by abe.gillespie: Getting constraint name from Postgres
http://code.google.com/p/dblinq2007/issues/detail?id=214

I noticed today while I perused the code that the Postgres provider does
not do a good job getting constraint names. It's assuming the name for a
PRIMARY KEY ends with "_pkey". This won't work. Primary keys may be
named anything you desire, having the "_pkey" suffix is merely an artifact
of the constraint added by the pgAdmin GUI. The following query should
clue you in on what's necessary:

select constraint_name from information_schema.table_constraints where
table_schema=@schema and table_name=@view and
constraint_type='PRIMARY KEY'

I did some detective work to find this which might help you in the future as
well. I turn on SQL Statement logging for Postgres and then use the
pgAdmin GUI to explore my DB. All the queries that the GUI does will be
logged and should allow you to figure out most anything schema related.

Thanks.
-Abe

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

dblin...@googlecode.com

unread,
Mar 17, 2010, 7:09:18 AM3/17/10
to dblin...@googlegroups.com
Updates:
Status: Accepted
Labels: Type-Defect Priority-Medium Component-PostgreSQL

Comment #1 on issue 214 by anders...@gmail.com: Getting constraint name
from Postgres
http://code.google.com/p/dblinq2007/issues/detail?id=214

Thanks for pointing it out. It was marked with a todo in the code.

dblin...@googlecode.com

unread,
Mar 19, 2010, 1:37:55 PM3/19/10
to dblin...@googlegroups.com

Comment #2 on issue 214 by abe.gillespie: Getting constraint name from
Postgres
http://code.google.com/p/dblinq2007/issues/detail?id=214

Glad I could help. Please keep up the great work; you've got a very
impressive and
extremely useful project going here.

dblin...@googlecode.com

unread,
Apr 1, 2012, 10:10:12 AM4/1/12
to dblin...@googlegroups.com

Comment #3 on issue 214 by tos.oliv...@gmail.com: Getting constraint name
from Postgres
http://code.google.com/p/dblinq2007/issues/detail?id=214

Hey, I fix it and another issues. You can download the source here:

http://code.google.com/p/dblinq2007/issues/detail?id=132#c2

dblin...@googlecode.com

unread,
Sep 22, 2012, 10:00:44 AM9/22/12
to dblin...@googlegroups.com

Comment #4 on issue 214 by kandrait...@gmail.com: Getting constraint name
from Postgres
http://code.google.com/p/dblinq2007/issues/detail?id=214

Hey guys!

I ran into this problem too, but all the constraints are affected by this
issue.

I did some refactoring to get this work, see the attached patch.

Dom

Attachments:
db_linq_postgresql_constraint_fix.patch 12.6 KB

Reply all
Reply to author
Forward
0 new messages