import java.util.Properties;
import net.jaekl.cfb.db.Sequence;
+import net.jaekl.cfb.db.Column.Type;
public class PostgresqlDriver extends DbDriver {
{
return " SELECT NEXTVAL('" + seq.getName() + "') ";
}
-}
+
+ @Override
+ protected String typeName(Type type) {
+ // Special case: TIMESTAMPTZ stored as INTEGER (milliseconds since the epoch)
+ // Reading a TIMESTAMPTZ back from the DB, and converting it to a java.util.Date,
+ // is fraught with peril. The best way around this is to store the dates in
+ // milliseconds-since-the-epoch (01.01.1970 00:00:00.000 UTC).
+ if (Type.TIMESTAMPTZ.equals(type)) {
+ return "BIGINT";
+ }
+
+ return type.toString();
+ }}