PostgreSQL data types mapped Java classes for JDBC - Mailing list pgsql-jdbc

From Thangalin
Subject PostgreSQL data types mapped Java classes for JDBC
Date
Msg-id AANLkTinsk4rwT7v-751bwQkgTN1rkA=8uE-jk69nape-@mail.gmail.com
Whole thread Raw
Responses Re: PostgreSQL data types mapped Java classes for JDBC
Re: PostgreSQL data types mapped Java classes for JDBC
List pgsql-jdbc
Hi, all.


Where are all the PostgreSQL data types mapped to Java classes? I have found the following from an old mailing list message:

1 data_type_id Data Type Id java.lang.Integer int4 11

2 smallint_type Smallint Type java.lang.Integer int2 6
3 int_type Int Type java.lang.Integer int4 11
4 bigint_type Bigint Type java.lang.Long int8 20
5 decimal_type Decimal Type java.math.BigDecimal numeric 18

6 numeric_type Numeric Type java.math.BigDecimal numeric 12
7 real_type Real Type java.lang.Float float4 14
8 doubleprecision_type Doubleprecision Type java.lang.Double float8 24
9 serial_type Serial Type java.lang.Integer int4 11

10 bigserial_type Bigserial Type java.lang.Long int8 20
11 varchar_type Varchar Type java.lang.String varchar 30
12 char_type Char Type java.lang.String bpchar 30
13 text_type Text Type java.lang.String text 2147483647

14 bytea_type Bytea Type [B bytea 2147483647
15 date_type Date Type java.sql.Date date 13
16 time_type Time Type java.sql.Time time 15
17 timetz_type Timetz Type java.sql.Time timetz 21
18 timestamp_type Timestamp Type java.sql.Timestamp timestamp 29

19 timestamptz_type Timestamptz Type java.sql.Timestamp timestamptz 35
20 interval_type Interval Type org.postgresql.util.PGInterval interval 49
21 boolean_type Boolean Type java.lang.Boolean bool 1
22 point_type Point Type org.postgresql.geometric.PGpoint point 2147483647 23 linesegment_type Linesegment Type org.postgresql.geometric.PGlseg lseg 2147483647
24 box_type Box Type org.postgresql.geometric.PGbox box 2147483647
25 path_type Path Type org.postgresql.geometric.PGpath path 2147483647
26 polygon_type Polygon Type org.postgresql.geometric.PGpolygon polygon 2147483647 27 circle_type Circle Type org.postgresql.geometric.PGcircle circle 2147483647
28 cidr_type Cidr Type java.lang.Object cidr 2147483647
29 inet_type Inet Type java.lang.Object inet 2147483647
30 macaddr_type Macaddr Type java.lang.Object macaddr 2147483647

31 bit2_type Bit2 Type java.lang.Boolean bit 2
32 bitvarying5_type Bitvarying5 Type java.lang.Object varbit 5

Where is the most recent list?

Thank you!
Dave

P.S.
If these are not already in the information_schema (or similar), I think they would make for a worthwhile addition.

Individual adaptions should not be stored external to PostgreSQL. It would be trivial to set up a relation that:
  1. Maintains a current list of PostgreSQL data types.
  2. Maintains a list of adapters (perhaps with effective dating).
  3. Maps adapters to Java types.
This would centralize the knowledge and facilitate dynamic implementations that, for whatever reason, need to know the correct data type mapping in an adapter-agnostic fashion. (Ideally adapters would map the PostgreSQL data types to Java classes the same way; centralizing the list would reveal to everyone the differences in the adapters without having to scour the web.)

This doesn't have to be packaged with PostgreSQL distributions: it could be offered as a separate script that people can run to update the information schema.

pgsql-jdbc by date:

Previous
From: Radosław Smogura
Date:
Subject: Re: The logic behind the prepared statement in PostgreSQL
Next
From: Thangalin
Date:
Subject: PostgreSQL data types mapped Java classes for JDBC