pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedDatabaseMetaData.getTypeInfo() - returns all tables as well
6+ messages / 2 participants
[nested] [flat]
* DatabaseMetaData.getTypeInfo() - returns all tables as well
@ 2015-09-30 19:37 Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Kellerer @ 2015-09-30 19:37 UTC (permalink / raw)
To: pgsql-jdbc
Hello,
DatabaseMetaData.getTypeInfo() returns not only data types, but also all table types.
Strictly speaking this is correct as the row type for a table is indeed a "data type" in Postgres,
but I think the information returned is way too much from a practical point of view.
This could be reduced at least a bit by not only excluding pg_toast, but also pg_catalog and information_schema types:
SELECT t.typname,t.oid
FROM pg_catalog.pg_type t
JOIN pg_catalog.pg_namespace n ON (t.typnamespace = n.oid)
WHERE n.nspname not in ('pg_toast', 'pg_catalog', 'information_schema')
(instead of WHERE n.nspname != 'pg_toast' in AbstractJdbc2DatabaseMetaData.java getTypeInfo())
What I find even more confusing (from a JDBC point of view) is that each table type is reported twice:
Once with the table's name and once with an underscore prefixing the table name, e.g. foo and _foo.
These entries map to pg_type rows with typtype = 'c' and 'b' respectively.
I wonder if it would make sense to filter out the "real" tables from this result.
And if it does, if there is an efficient way of doing that and not removing real composite types
from the result at the same time.
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] 6+ messages in thread
* Re: DatabaseMetaData.getTypeInfo() - returns all tables as well
@ 2015-10-01 11:23 Dave Cramer <pg@fastcrypt.com>
parent: Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 1 reply; 6+ messages in thread
From: Dave Cramer @ 2015-10-01 11:23 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc
Hi Thomas,
Any chance you could provide a github pull request ?
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On 30 September 2015 at 15:37, Thomas Kellerer <spam_eater@gmx.net> wrote:
> Hello,
>
> DatabaseMetaData.getTypeInfo() returns not only data types, but also all
> table types.
>
> Strictly speaking this is correct as the row type for a table is indeed a
> "data type" in Postgres,
> but I think the information returned is way too much from a practical
> point of view.
>
> This could be reduced at least a bit by not only excluding pg_toast, but
> also pg_catalog and information_schema types:
>
> SELECT t.typname,t.oid
> FROM pg_catalog.pg_type t
> JOIN pg_catalog.pg_namespace n ON (t.typnamespace = n.oid)
> WHERE n.nspname not in ('pg_toast', 'pg_catalog', 'information_schema')
>
> (instead of WHERE n.nspname != 'pg_toast' in
> AbstractJdbc2DatabaseMetaData.java getTypeInfo())
>
>
> What I find even more confusing (from a JDBC point of view) is that each
> table type is reported twice:
>
> Once with the table's name and once with an underscore prefixing the table
> name, e.g. foo and _foo.
>
> These entries map to pg_type rows with typtype = 'c' and 'b' respectively.
>
> I wonder if it would make sense to filter out the "real" tables from this
> result.
> And if it does, if there is an efficient way of doing that and not
> removing real composite types
> from the result at the same time.
>
>
> 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] 6+ messages in thread
* Re: DatabaseMetaData.getTypeInfo() - returns all tables as well
@ 2015-10-01 12:51 Thomas Kellerer <spam_eater@gmx.net>
parent: Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Kellerer @ 2015-10-01 12:51 UTC (permalink / raw)
To: pgsql-jdbc
Sorry, I am not registered with GitHub (nor using it)
Regards
Thomas
Dave Cramer schrieb am 01.10.2015 um 13:23:
> Hi Thomas,
>
> Any chance you could provide a github pull request ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
> On 30 September 2015 at 15:37, Thomas Kellerer <spam_eater@gmx.net <mailto:spam_eater@gmx.net>> wrote:
>
> Hello,
>
> DatabaseMetaData.getTypeInfo() returns not only data types, but also all table types.
>
> Strictly speaking this is correct as the row type for a table is indeed a "data type" in Postgres,
> but I think the information returned is way too much from a practical point of view.
>
> This could be reduced at least a bit by not only excluding pg_toast, but also pg_catalog and information_schema types:
>
> SELECT t.typname,t.oid
> FROM pg_catalog.pg_type t
> JOIN pg_catalog.pg_namespace n ON (t.typnamespace = n.oid)
> WHERE n.nspname not in ('pg_toast', 'pg_catalog', 'information_schema')
>
> (instead of WHERE n.nspname != 'pg_toast' in AbstractJdbc2DatabaseMetaData.java getTypeInfo())
>
>
> What I find even more confusing (from a JDBC point of view) is that each table type is reported twice:
>
> Once with the table's name and once with an underscore prefixing the table name, e.g. foo and _foo.
>
> These entries map to pg_type rows with typtype = 'c' and 'b' respectively.
>
> I wonder if it would make sense to filter out the "real" tables from this result.
> And if it does, if there is an efficient way of doing that and not removing real composite types
> from the result at the same time.
>
>
> Regards
> Thomas
>
>
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org <mailto:pgsql-jdbc@postgresql.org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
>
--
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] 6+ messages in thread
* Re: DatabaseMetaData.getTypeInfo() - returns all tables as well
@ 2015-10-19 15:33 Dave Cramer <pg@fastcrypt.com>
parent: Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 1 reply; 6+ messages in thread
From: Dave Cramer @ 2015-10-19 15:33 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc
This change breaks more than it fixes!
What is your specific problem with returning tables ?
Dave Cramer
davec@postgresintl.com
www.postgresintl.com
On 1 October 2015 at 08:51, Thomas Kellerer <spam_eater@gmx.net> wrote:
> Sorry, I am not registered with GitHub (nor using it)
>
> Regards
> Thomas
>
> Dave Cramer schrieb am 01.10.2015 um 13:23:
> > Hi Thomas,
> >
> > Any chance you could provide a github pull request ?
> >
> > Dave Cramer
> >
> > dave.cramer(at)credativ(dot)ca
> > http://www.credativ.ca
> >
> > On 30 September 2015 at 15:37, Thomas Kellerer <spam_eater@gmx.net
> <mailto:spam_eater@gmx.net>> wrote:
> >
> > Hello,
> >
> > DatabaseMetaData.getTypeInfo() returns not only data types, but also
> all table types.
> >
> > Strictly speaking this is correct as the row type for a table is
> indeed a "data type" in Postgres,
> > but I think the information returned is way too much from a
> practical point of view.
> >
> > This could be reduced at least a bit by not only excluding pg_toast,
> but also pg_catalog and information_schema types:
> >
> > SELECT t.typname,t.oid
> > FROM pg_catalog.pg_type t
> > JOIN pg_catalog.pg_namespace n ON (t.typnamespace = n.oid)
> > WHERE n.nspname not in ('pg_toast', 'pg_catalog',
> 'information_schema')
> >
> > (instead of WHERE n.nspname != 'pg_toast' in
> AbstractJdbc2DatabaseMetaData.java getTypeInfo())
> >
> >
> > What I find even more confusing (from a JDBC point of view) is that
> each table type is reported twice:
> >
> > Once with the table's name and once with an underscore prefixing the
> table name, e.g. foo and _foo.
> >
> > These entries map to pg_type rows with typtype = 'c' and 'b'
> respectively.
> >
> > I wonder if it would make sense to filter out the "real" tables from
> this result.
> > And if it does, if there is an efficient way of doing that and not
> removing real composite types
> > from the result at the same time.
> >
> >
> > Regards
> > Thomas
> >
> >
> >
> >
> > --
> > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org <mailto:
> pgsql-jdbc@postgresql.org>)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-jdbc
> >
> >
>
>
>
> --
> 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] 6+ messages in thread
* Re: DatabaseMetaData.getTypeInfo() - returns all tables as well
@ 2015-10-20 06:07 Thomas Kellerer <spam_eater@gmx.net>
parent: Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Kellerer @ 2015-10-20 06:07 UTC (permalink / raw)
To: pgsql-jdbc
No particular problem besides performance.
But I'm surprised: why would this break anything?
Why does the driver rely on tables from pg_catalog be returned for type information?
Thomas
Dave Cramer schrieb am 19.10.2015 um 17:33:
> This change breaks more than it fixes!
>
> What is your specific problem with returning tables ?
>
> Dave Cramer
>
> davec@postgresintl.com <mailto:davec@postgresintl.com>
> www.postgresintl.com <http://www.postgresintl.com;
>
> On 1 October 2015 at 08:51, Thomas Kellerer <spam_eater@gmx.net <mailto:spam_eater@gmx.net>> wrote:
>
> Sorry, I am not registered with GitHub (nor using it)
>
> Regards
> Thomas
>
> Dave Cramer schrieb am 01.10.2015 um 13:23:
> > Hi Thomas,
> >
> > Any chance you could provide a github pull request ?
> >
> > Dave Cramer
> >
> > dave.cramer(at)credativ(dot)ca
> > http://www.credativ.ca
> >
> > On 30 September 2015 at 15:37, Thomas Kellerer <spam_eater@gmx.net <mailto:spam_eater@gmx.net> <mailto:spam_eater@gmx.net <mailto:spam_eater@gmx.net>>> wrote:
> >
> > Hello,
> >
> > DatabaseMetaData.getTypeInfo() returns not only data types, but also all table types.
> >
> > Strictly speaking this is correct as the row type for a table is indeed a "data type" in Postgres,
> > but I think the information returned is way too much from a practical point of view.
> >
> > This could be reduced at least a bit by not only excluding pg_toast, but also pg_catalog and information_schema types:
> >
> > SELECT t.typname,t.oid
> > FROM pg_catalog.pg_type t
> > JOIN pg_catalog.pg_namespace n ON (t.typnamespace = n.oid)
> > WHERE n.nspname not in ('pg_toast', 'pg_catalog', 'information_schema')
> >
> > (instead of WHERE n.nspname != 'pg_toast' in AbstractJdbc2DatabaseMetaData.java getTypeInfo())
> >
> >
> > What I find even more confusing (from a JDBC point of view) is that each table type is reported twice:
> >
> > Once with the table's name and once with an underscore prefixing the table name, e.g. foo and _foo.
> >
> > These entries map to pg_type rows with typtype = 'c' and 'b' respectively.
> >
> > I wonder if it would make sense to filter out the "real" tables from this result.
> > And if it does, if there is an efficient way of doing that and not removing real composite types
> > from the result at the same time.
> >
> >
> > Regards
> > Thomas
> >
> >
> >
> >
> > --
> > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org <mailto:pgsql-jdbc@postgresql.org> <mailto:pgsql-jdbc@postgresql.org <mailto:pgsql-jdbc@postgresql.org>>)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-jdbc
> >
> >
>
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org <mailto:pgsql-jdbc@postgresql.org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
>
--
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] 6+ messages in thread
* Re: DatabaseMetaData.getTypeInfo() - returns all tables as well
@ 2015-10-20 11:21 Dave Cramer <pg@fastcrypt.com>
parent: Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 0 replies; 6+ messages in thread
From: Dave Cramer @ 2015-10-20 11:21 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc
The problem isnt the driver, it is everyone else.
See the discussion here
https://github.com/pgjdbc/pgjdbc/pull/382#issuecomment-145838971
Dave Cramer
davec@postgresintl.com
www.postgresintl.com
On 20 October 2015 at 02:07, Thomas Kellerer <spam_eater@gmx.net> wrote:
> No particular problem besides performance.
>
> But I'm surprised: why would this break anything?
> Why does the driver rely on tables from pg_catalog be returned for type
> information?
>
> Thomas
>
> Dave Cramer schrieb am 19.10.2015 um 17:33:
> > This change breaks more than it fixes!
> >
> > What is your specific problem with returning tables ?
> >
> > Dave Cramer
> >
> > davec@postgresintl.com <mailto:davec@postgresintl.com>
> > www.postgresintl.com <http://www.postgresintl.com;
> >
> > On 1 October 2015 at 08:51, Thomas Kellerer <spam_eater@gmx.net <mailto:
> spam_eater@gmx.net>> wrote:
> >
> > Sorry, I am not registered with GitHub (nor using it)
> >
> > Regards
> > Thomas
> >
> > Dave Cramer schrieb am 01.10.2015 um 13:23:
> > > Hi Thomas,
> > >
> > > Any chance you could provide a github pull request ?
> > >
> > > Dave Cramer
> > >
> > > dave.cramer(at)credativ(dot)ca
> > > http://www.credativ.ca
> > >
> > > On 30 September 2015 at 15:37, Thomas Kellerer <spam_eater@gmx.net
> <mailto:spam_eater@gmx.net> <mailto:spam_eater@gmx.net <mailto:
> spam_eater@gmx.net>>> wrote:
> > >
> > > Hello,
> > >
> > > DatabaseMetaData.getTypeInfo() returns not only data types,
> but also all table types.
> > >
> > > Strictly speaking this is correct as the row type for a table
> is indeed a "data type" in Postgres,
> > > but I think the information returned is way too much from a
> practical point of view.
> > >
> > > This could be reduced at least a bit by not only excluding
> pg_toast, but also pg_catalog and information_schema types:
> > >
> > > SELECT t.typname,t.oid
> > > FROM pg_catalog.pg_type t
> > > JOIN pg_catalog.pg_namespace n ON (t.typnamespace = n.oid)
> > > WHERE n.nspname not in ('pg_toast', 'pg_catalog',
> 'information_schema')
> > >
> > > (instead of WHERE n.nspname != 'pg_toast' in
> AbstractJdbc2DatabaseMetaData.java getTypeInfo())
> > >
> > >
> > > What I find even more confusing (from a JDBC point of view) is
> that each table type is reported twice:
> > >
> > > Once with the table's name and once with an underscore
> prefixing the table name, e.g. foo and _foo.
> > >
> > > These entries map to pg_type rows with typtype = 'c' and 'b'
> respectively.
> > >
> > > I wonder if it would make sense to filter out the "real"
> tables from this result.
> > > And if it does, if there is an efficient way of doing that and
> not removing real composite types
> > > from the result at the same time.
> > >
> > >
> > > Regards
> > > Thomas
> > >
> > >
> > >
> > >
> > > --
> > > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org
> <mailto:pgsql-jdbc@postgresql.org> <mailto:pgsql-jdbc@postgresql.org
> <mailto:pgsql-jdbc@postgresql.org>>)
> > > To make changes to your subscription:
> > > http://www.postgresql.org/mailpref/pgsql-jdbc
> > >
> > >
> >
> >
> >
> > --
> > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org <mailto:
> pgsql-jdbc@postgresql.org>)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-jdbc
> >
> >
>
>
>
> --
> 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] 6+ messages in thread
end of thread, other threads:[~2015-10-20 11:21 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-09-30 19:37 DatabaseMetaData.getTypeInfo() - returns all tables as well Thomas Kellerer <spam_eater@gmx.net>
2015-10-01 11:23 ` Dave Cramer <pg@fastcrypt.com>
2015-10-01 12:51 ` Thomas Kellerer <spam_eater@gmx.net>
2015-10-19 15:33 ` Dave Cramer <pg@fastcrypt.com>
2015-10-20 06:07 ` Thomas Kellerer <spam_eater@gmx.net>
2015-10-20 11:21 ` 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