pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC driver and Postgres 9.6beta
7+ messages / 4 participants
[nested] [flat]

* JDBC driver and Postgres 9.6beta
@ 2016-05-14 11:42  Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 7+ messages in thread

From: Thomas Kellerer @ 2016-05-14 11:42 UTC (permalink / raw)
  To: pgsql-jdbc

while testing Postgres 9.6beta1 with the current JDBC driver I noticed that the driver fails to retrieve the indexes for a table because the catalog table pg_am has changed in 9.6

The error message is:

    ERROR: column am.amcanorder does not exist

Regards
Thomas
  



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: JDBC driver and Postgres 9.6beta
@ 2016-05-14 13:57  Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
  parent: Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 2 replies; 7+ messages in thread

From: Vladimir Sitnikov @ 2016-05-14 13:57 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; pgsql-jdbc

Thanks for the report,

I've commented out amcanorder for 9.6 here:
https://github.com/pgjdbc/pgjdbc/pull/560

Does anybody know what is the proper way to tell if index column is ASC or
DESC in 9.6+?

pgjdbc used something like
  CASE pg_am.amcanorder
    WHEN true THEN CASE pg_index.indoption[(pg_index.keys).n - 1] & 1
      WHEN 1 THEN 'D'
      ELSE 'A'
    END
    ELSE NULL
  END AS ASC_OR_DESC,

Vladimir

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: JDBC driver and Postgres 9.6beta
@ 2016-05-14 14:33  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Tom Lane @ 2016-05-14 14:33 UTC (permalink / raw)
  To: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>; +Cc: Thomas Kellerer <spam_eater@gmx.net>; pgsql-jdbc

Vladimir Sitnikov <sitnikov.vladimir@gmail.com> writes:
> Does anybody know what is the proper way to tell if index column is ASC or
> DESC in 9.6+?

Using pg_get_indexdef() would leave you much less vulnerable to cross-
version differences in the system catalogs.

			regards, tom lane


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: JDBC driver and Postgres 9.6beta
@ 2016-05-14 14:41  Dave Cramer <pg@fastcrypt.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 7+ messages in thread

From: Dave Cramer @ 2016-05-14 14:41 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>; Thomas Kellerer <spam_eater@gmx.net>; pgsql-jdbc

That means parsing the response.. I gather there is nothing machine
readable ?

Dave Cramer

davec@postgresintl.com
www.postgresintl.com

On 14 May 2016 at 10:33, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Vladimir Sitnikov <sitnikov.vladimir@gmail.com> writes:
> > Does anybody know what is the proper way to tell if index column is ASC
> or
> > DESC in 9.6+?
>
> Using pg_get_indexdef() would leave you much less vulnerable to cross-
> version differences in the system catalogs.
>
>                         regards, tom lane
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: JDBC driver and Postgres 9.6beta
@ 2016-05-14 14:49  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Dave Cramer <pg@fastcrypt.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2016-05-14 14:49 UTC (permalink / raw)
  To: Dave Cramer <pg@fastcrypt.com>; +Cc: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>; Thomas Kellerer <spam_eater@gmx.net>; pgsql-jdbc

Dave Cramer <pg@fastcrypt.com> writes:
> On 14 May 2016 at 10:33, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Using pg_get_indexdef() would leave you much less vulnerable to cross-
>> version differences in the system catalogs.

> That means parsing the response..

True.  If it seems like too much churn, I think you wouldn't go very far
wrong by assuming that ASC/DESC is only relevant to btree indexes.

			regards, tom lane


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: JDBC driver and Postgres 9.6beta
@ 2016-05-17 06:10  Thomas Kellerer <spam_eater@gmx.net>
  parent: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Thomas Kellerer @ 2016-05-17 06:10 UTC (permalink / raw)
  To: pgsql-jdbc

Vladimir Sitnikov schrieb am 14.05.2016 um 15:57:
> Thanks for the report,
> 
> I've commented out amcanorder for 9.6 here: https://github.com/pgjdbc/pgjdbc/pull/560
> 
> Does anybody know what is the proper way to tell if index column is ASC or DESC in 9.6+?

Based on Tom's statement that only btree indexes can be sorted, the following seems better then just returning NULL:

  CASE am.amname
     WHEN 'btree' THEN 
       CASE i.indoption[(i.keys).n - 1] & 1 
          WHEN 1 THEN 'D' 
          ELSE 'A'
       END
       ELSE NULL
  END AS ASC_OR_DESC, 



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: JDBC driver and Postgres 9.6beta
@ 2016-05-17 10:27  Dave Cramer <pg@fastcrypt.com>
  parent: Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 0 replies; 7+ messages in thread

From: Dave Cramer @ 2016-05-17 10:27 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc

see https://github.com/pgjdbc/pgjdbc/pull/569

Dave Cramer

davec@postgresintl.com
www.postgresintl.com

On 17 May 2016 at 02:10, Thomas Kellerer <spam_eater@gmx.net> wrote:

> Vladimir Sitnikov schrieb am 14.05.2016 um 15:57:
> > Thanks for the report,
> >
> > I've commented out amcanorder for 9.6 here:
> https://github.com/pgjdbc/pgjdbc/pull/560
> >
> > Does anybody know what is the proper way to tell if index column is ASC
> or DESC in 9.6+?
>
> Based on Tom's statement that only btree indexes can be sorted, the
> following seems better then just returning NULL:
>
>   CASE am.amname
>      WHEN 'btree' THEN
>        CASE i.indoption[(i.keys).n - 1] & 1
>           WHEN 1 THEN 'D'
>           ELSE 'A'
>        END
>        ELSE NULL
>   END AS ASC_OR_DESC,
>
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2016-05-17 10:27 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-14 11:42 JDBC driver and Postgres 9.6beta Thomas Kellerer <spam_eater@gmx.net>
2016-05-14 13:57 ` Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
2016-05-14 14:33   ` Tom Lane <tgl@sss.pgh.pa.us>
2016-05-14 14:41     ` Dave Cramer <pg@fastcrypt.com>
2016-05-14 14:49       ` Tom Lane <tgl@sss.pgh.pa.us>
2016-05-17 06:10   ` Thomas Kellerer <spam_eater@gmx.net>
2016-05-17 10:27     ` Dave Cramer <pg@fastcrypt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox