pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steven Bradley <sbradley@llnl.gov>
To: Esteban Chiner Sanz <echiner@tissat.es>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Problem with timestamp and primary key.
Date: Tue, 13 Jul 1999 08:24:50 -0700
Message-ID: <3.0.5.32.19990713082450.00927100@poptop.llnl.gov> (raw)
In-Reply-To: <378AE74F.C804CB78@tissat.es>

I have the same problem, except that my TIMESTAMP column is not the PK;
instead it's just a column that I wanted to index.  Unfortunately, there is
no solution since Postgres currently does not support indexes on TIMESTAMPS
(Postgres automatically tries to create an index on all PKs) and does not
provide JDBC access to DATETIME columns.  For your particular situation you
might try placing the TIMESTAMP column outside the PK (and not have it
indexed) and then use a surrogate key with a sequence.  This isn't entirely
normalized, but I've seen worse!

Hope this helps





At 09:14 AM 7/13/99 +0200, you wrote:
>When I try to execute this sentence:
>
>CREATE TABLE ACCESO(
>USR_CODIGO        VARCHAR(20) NOT NULL DEFAULT '0',             --Código
>del usuario
>SER_CODIGO        VARCHAR(10) NOT NULL DEFAULT '0',             --Código
>del servicio
>ACC_FECHAA        TIMESTAMP NOT NULL,
>ACC_FECHAZ        TIMESTAMP,
>CONSTRAINT C_ACC PRIMARY KEY (USR_CODIGO,SER_CODIGO,ACC_FECHAA));
>
>I get this error message:
>
>NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index c_acc for
>table acceso
>ERROR:  Can't find a default operator class for type 1296.
>EOF
>
>Does anybody know what could be the problem. What should I do?
>The problem is that I could subtitute TIMESTAMP with DATE or DATETIME
>but that's not compatible with Oracle's DATE and, when I try to access
>the table with JDBC in Oracle works fine but in Postgres it needs to be
>Timestamp.
>Please help,
>
>        Esteban
>
>------------------------------------------------------------
> Esteban Chiner Sanz        mailto (work): echiner@tissat.es
> TISSAT                     mailto (home): echiner@abonados.cplus.es
> Av. Aragon, 30, 5ª planta  Phone: 96 393 9950
> Valencia (SPAIN)
>
>
>
>
>


Steven Bradley
Lawrence Livermore National Laboratory
PO Box 808
Livermore, California 94550
(925) 423-2101       sbradley@llnl.gov



view thread (4+ messages)  latest in thread

Message-ID: <3.0.5.32.19990713082450.00927100@poptop.llnl.gov>
Permalink:  ../3.0.5.32.19990713082450.00927100@poptop.llnl.gov/
Also on:    postgresql.org/message-id/3.0.5.32.19990713082450.00927100@poptop.llnl.gov

 · 

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-sql@postgresql.org
  Cc: sbradley@llnl.gov, echiner@tissat.es
  Subject: Re: [SQL] Problem with timestamp and primary key.
  In-Reply-To: <3.0.5.32.19990713082450.00927100@poptop.llnl.gov>
  References: <378AE74F.C804CB78@tissat.es> <3.0.5.32.19990713082450.00927100@poptop.llnl.gov>

* 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