i mentionned my problem to a coworker and he gave me this SQL to get the primary key&#39;s name either a table or a view.<br><br>SELECT column_name  FROM information_schema.view_table_usage vtu <br>JOIN information_schema.constraint_column_usage ccu ON vtu.table_name = ccu.table_name<br>
JOIN pg_constraint c ON c.conname=ccu.constraint_name<br>WHERE vtu.view_name = &#39;table_or_view_name&#39;<br>AND c.contype=&#39;p&#39;<br>UNION <br>SELECT column_name  FROM information_schema.constraint_column_usage ccu <br>
JOIN pg_constraint c ON c.conname=ccu.constraint_name<br>WHERE ccu.table_name = &#39;table_or_view_name&#39;<br>AND c.contype=&#39;p&#39;<br><br><span id="result_box" class="short_text" lang="en"><span class="hps">I wondered if</span> <span class="hps">this could</span> <span class="hps">replace the current SQL to get the primary key&#39;s name or it will cause problems elsewhere ?<br>
<br><br>Marc-André Trottier<br></span></span>