pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Datatype of domains not reported correctly.
3+ messages / 2 participants
[nested] [flat]

* Datatype of domains not reported correctly.
@ 2009-08-01 20:53 Thomas Kellerer <spam_eater@gmx.net>
  2009-08-03 17:44 ` Re: Datatype of domains not reported correctly. Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Thomas Kellerer @ 2009-08-01 20:53 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

I noticed that the getColumns() driver dos not return the proper java.sql.Types value for columns 
that are defined through a domain.

I was looking at the pagila sample database. The table film contains the column release_year which 
is defined as year. The domain year is defined as

CREATE DOMAIN year AS integer
	CONSTRAINT year_check CHECK (((VALUE >= 1901) AND (VALUE <= 2155)));

When using getColumns() the driver returns the value 2001 for DATA_TYPE (which is 
java.sql.Types.DISTINCT).

Maybe I'm missing something, but I would have expected the driver to return the numeric value for 
the underlying datatype (java.sql.Types.INTEGER in this case).
Or at least java.sql.Types.OTHER (the way it's done for enums)

Regards
Thomas




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

* Re: Datatype of domains not reported correctly.
  2009-08-01 20:53 Datatype of domains not reported correctly. Thomas Kellerer <spam_eater@gmx.net>
@ 2009-08-03 17:44 ` Kris Jurka <books@ejurka.com>
  2009-08-03 18:11   ` Re: Datatype of domains not reported correctly. Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Kris Jurka @ 2009-08-03 17:44 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc



On Sat, 1 Aug 2009, Thomas Kellerer wrote:

> I noticed that the getColumns() driver dos not return the proper 
> java.sql.Types value for columns that are defined through a domain.
>
> CREATE DOMAIN year AS integer
> 	CONSTRAINT year_check CHECK (((VALUE >= 1901) AND (VALUE <= 2155)));
>
> When using getColumns() the driver returns the value 2001 for DATA_TYPE 
> (which is java.sql.Types.DISTINCT).

DISTINCT is the JDBC equivalent term for domains.

See Chapter 16 if the JDBC4 spec.

DISTINCT type - a user-defined type based on a built-in type; for 
example: CREATE TYPE MONEY AS NUMERIC(10,2) FINAL

So I believe we're doing the right thing here, although our support for 
DISTINCT elsewhere is probably lacking.

Kris Jurka



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

* Re: Datatype of domains not reported correctly.
  2009-08-01 20:53 Datatype of domains not reported correctly. Thomas Kellerer <spam_eater@gmx.net>
  2009-08-03 17:44 ` Re: Datatype of domains not reported correctly. Kris Jurka <books@ejurka.com>
@ 2009-08-03 18:11   ` Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Kellerer @ 2009-08-03 18:11 UTC (permalink / raw)
  To: pgsql-jdbc

Kris Jurka wrote on 03.08.2009 19:44:
> DISTINCT is the JDBC equivalent term for domains.
> 
> See Chapter 16 if the JDBC4 spec.
> 
> DISTINCT type - a user-defined type based on a built-in type; for 
> example: CREATE TYPE MONEY AS NUMERIC(10,2) FINAL
> 
> So I believe we're doing the right thing here, although our support for 
> DISTINCT elsewhere is probably lacking.

Thanks for the detailed answer. I have to admit that I didn't check the JDBC spec completely.

If the specs require this, I can live with it - although I think the spec is "wrong" here ;)

Regards
Thomas




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


end of thread, other threads:[~2009-08-03 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-08-01 20:53 Datatype of domains not reported correctly. Thomas Kellerer <spam_eater@gmx.net>
2009-08-03 17:44 ` Kris Jurka <books@ejurka.com>
2009-08-03 18:11   ` Thomas Kellerer <spam_eater@gmx.net>

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