Re: Release 1204 released - Mailing list pgsql-jdbc

From Mark Rotteveel
Subject Re: Release 1204 released
Date
Msg-id 94c49a4184f50d69ff0da0f9237496a7@imap.procolix.com
Whole thread Raw
In response to Re: Release 1204 released  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc
From a SQL perspective, a view is indistinguishable from a table, so JDBC
expects you to handle them the same. This should also be clear from the
description of getTables, especially this column of the getTables
resultSet: "TABLE_TYPE String => table type. Typical types are "TABLE",
"VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS",
"SYNONYM"".

In other words, JDBC (and - IIRC - the SQL standard for that matter),
consider a view a table type (or more correctly: a relation), therefor
getColumns should return the columns of a view.

You can easily replace an existing view with a table (or vice versa), and
your application should be able to continue working as is.

Mark

On Thu, 15 Oct 2015 16:47:34 -0400, Dave Cramer <pg@fastcrypt.com> wrote:
> So I am looking at the API reference and no where does it say getColumns
> should return information about views.
>
> That being said the fact that getTables returns the type of the table
there
> may be some inference that it should ?
>
> Lance, do you have some insight here ?
>
> Dave Cramer
>
> davec@postgresintl.com
> www.postgresintl.com
>
> On 15 October 2015 at 07:10, Dave Cramer <pg@fastcrypt.com> wrote:
>
>> Yes, this looks like it needs to be reverted....
>>
>> Dave Cramer
>>
>> davec@postgresintl.com
>> www.postgresintl.com
>>
>> On 15 October 2015 at 05:10, Thomas Kellerer <spam_eater@gmx.net>
wrote:
>>
>>> Dave Cramer schrieb am 09.10.2015 um 21:32:
>>> >   * fix: filter DatabaseMetaData.getColumns by tables PR #386
>>> >   (0c95126)
>>>
>>> Why was this done?
>>>
>>> From my perspective this is a serious bug, because now getColumns()
>>> doesn't return column information for views, materialized views or
>>> foreign
>>> tables any more.
>>>
>>> Which in turn means that the SQL client I am maintaining (SQL
>>> Workbench/J) is no longer able to display column information for
>>> anything
>>> else than tables.
>>>
>>> I would assume that this is true for any other JDBC based SQL client.
It
>>> will also break tools like Liquibase and probably Hibernate as well as
>>> they
>>> also rely on getColumns() to return information about views (I am sure
>>> about Liquibase, not 100% sure about Hibernate though)
>>>
>>>
>>> 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
>>>
>>
>>


pgsql-jdbc by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Release 1204 released
Next
From: Mark Rotteveel
Date:
Subject: Re: Release 1204 released