Subject: [postgresql-interfaces/psqlodbc] issue #92: SQLSpecialColumns not working as expected in the shared standalone

From: "abhi-555 (@abhi-555)" <[email-masked]>
Date: Tue, 18 Feb 2025 10:55:46 +0000

After using the fix provided in https://github.com/postgresql-interfaces/psqlodbc/issues/79

I am still receiving zero rows upon running SQLSpecialColumns in the given test case in the shared standalone.

Can you please run the test case in the standalone [SQLSpecialColumns.zip](https://github.com/user-attachments/files/17919927/SQLSpecialColumns.zip) and confirm if this is working for you?

Test case
CREATE TABLE test_special( id integer, ival integer);
CREATE UNIQUE index test_special_id on public.test_special(id);
CREATE UNIQUE index test_special_ui on public.test_special(ival);

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Fri, 21 Feb 2025 14:10:38 +0000

Yes, can confirm that it does not work. I'm at odds as the test case does work. Looking into it.
Dave

---

From: "abhi-555 (@abhi-555)" <[email-masked]>
Date: Tue, 11 Mar 2025 05:20:37 +0000

Can you please provide any updates on this?

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Tue, 11 Mar 2025 13:25:03 +0000

Hi,

I'm stuck trying to debug this. It works fine in the test cases for ODBC, however in a standalone program it doesn't. 

I'm still working on it.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Wed, 12 Mar 2025 14:38:39 +0000

@abhi-555 I  just merged a PR that should fix this. Please let me know

---

From: "abhi-555 (@abhi-555)" <[email-masked]>
Date: Mon, 14 Apr 2025 05:23:46 +0000

I have tested this. I am not getting the column name but the schema name in the result set. We are binding the result set to the second column in the query. Isn't that supposed to be column name according to the ODBC standard?

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Tue, 15 Apr 2025 18:45:11 +0000

you are correct, sorry about that. I'll try to get something out in the next few days

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Wed, 16 Apr 2025 01:36:28 +0000

OK just merged in #109 which should fix this.

---

From: "abhi-555 (@abhi-555)" <[email-masked]>
Date: Tue, 20 May 2025 04:37:29 +0000

I tested the fix. It is working in cases when there is only one unique index on the table. However, if there are two(multiple) unique indexes on the table, we are getting columns from both the indexes in the result which is not the correct behaviour according to my understanding. 

We should ideally only get columns from one index in the result. Can you please check this case? Below is the use case for reference

CREATE TABLE public.users (
    id integer
    username VARCHAR(40),
    email VARCHAR(50),
);

CREATE UNIQUE INDEX idx_users1 ON public.users(username);
CREATE UNIQUE INDEX idx_users2 ON public.users(email);

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Tue, 20 May 2025 11:45:35 +0000

Just read the docs, and you are correct. I will have a look shortly

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Thu, 12 Jun 2025 09:55:40 +0000

I have committed code that should resolve this issue. Please let me know.