pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christian Cryder <c.s.cryder@gmail.com>
To: List <pgsql-jdbc@postgresql.org>
Subject: Custom types in Postgres, JDBC
Date: Wed, 20 Jul 2005 14:52:21 -0600
Message-ID: <90876a9e05072013521b8d8e98@mail.gmail.com> (raw)

Here's a question. Let's say I wanted to create a custom datatype in
Postrgres - something like a timezone2 which would persist the data as
millis. Does anyone have any pointers on where one would start in
thinking about this?

I am pretty sure that I could implement something in our statement
wrapper classes that would allow me to convert timestamps to millis
values and then save them as bigints rather than timestamps. And I
could probably create a couple of stored proc functions on the server
for easily displaying such millis as timestamps, and querying against
them via a timestamp string.

So I guess what I am asking is - how would one actually do it at a
lower level - defining a new type within postgres, and then having
that mapped to a new custom type (which my wrapper classes could then
convert to java.sql.Timestamps). I realize this is more than just a
JDBC question, but JDBC certainly plays a role in it.

Any thoughts on whether this is a good idea or a bad one? Any pointers? Caveats?

Thanks,
Christian



view thread (2+ messages)  latest in thread

Message-ID: <90876a9e05072013521b8d8e98@mail.gmail.com>
Permalink:  ../90876a9e05072013521b8d8e98@mail.gmail.com/
Also on:    postgresql.org/message-id/90876a9e05072013521b8d8e98@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: c.s.cryder@gmail.com
  Subject: Re: Custom types in Postgres, JDBC
  In-Reply-To: <90876a9e05072013521b8d8e98@mail.gmail.com>
  References: <90876a9e05072013521b8d8e98@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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