Does included columns part of the PK

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Does included columns part of the PK
Date: 2026-03-14 07:09:04
Message-ID: CA+FnnTz7+dbyk5Gn2iM-eo1Xvfax15yjBevmCCfvo0-UVW1K7Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-odbc

Hi, ALL,
Have one weird question ;-)

When I connect with ODBC and call SQLPrimaryKey() the function returns
all fields including
"included" fields.

However running libpq and trying to get the table info with:

[quote]
L"SELECT DISTINCT column_name, data_type,
character_maximum_length, character_octet_length, numeric_precision,
numeric_precision_radix, numeric_scale, is_nullable, column_default,
CASE WHEN column_name IN (SELECT ccu.column_name FROM
information_schema.constraint_column_usage ccu,
information_schema.table_constraints tc WHERE ccu.constraint_name =
tc.constraint_name AND tc.constraint_type = 'PRIMARY KEY' AND
ccu.table_name = $2) THEN 'YES' ELSE 'NO' END AS is_pk,
ordinal_position FROM information_schema.columns col,
information_schema.table_constraints tc WHERE tc.table_schema =
col.table_schema AND tc.table_name = col.table_name AND
col.table_schema = $1 AND col.table_name = $2 ORDER BY
ordinal_position;";
[/quote]

I'm getting only direct PK fields.

I presume that libpq is correct and the ODBC driver is the one that
needs to be fixed.

Just wanted to ask this list before going to complain to the ODBC list... ;-)

Thank you.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor Korot 2026-03-14 07:12:42 Re: Does included columns part of the PK
Previous Message Adrian Klaver 2026-03-14 04:51:29 Re: libpq usage from C++

Browse pgsql-odbc by date

  From Date Subject
Next Message Igor Korot 2026-03-14 07:12:42 Re: Does included columns part of the PK
Previous Message Nick Gorham 2026-03-09 09:03:13 Re: How to properly perform this?