timestamp error cant find class for type 1296

Поиск
Список
Период
Сортировка
Искать

timestamp error cant find class for type 1296

От:
crypt0genic <crypt0genic@ecad.org>
Дата:

When attempting to create the following table:

CREATE TABLE test (
								id timestamp primary key,
								fodder varchar(64)
								);


I get the following error:
ERROR:  Can't fine a default operator CLASS for type 1296

Whats that all about? ;)

If I create the table as follows (which AFAIK is equivilant):
CREATE TABLE test2 (
								id datetime primary key,
								fodder varchar(64)
								);

It creates fine but when I try to insert something like:

INSERT INTO test2 (fodder) VALUES ('arfarf');

I get:
ERROR: ExecAppend: Fail to add null value in not null value attribute id

I thought that the datetime field would be filled automatically on a insert with a current timestamp. can someone point out what Im doin wrong.

Thnx all,
-crypt0genic



-- 
Reverse engineering, the most fun and usually the most effective way
to tackle a problem or learn something new.
Public PGP key:		http://www.ecad.org/crypt0genic.pkr
Fingerprint: 		A4F6 9F69 7C89 0AC0 9F9F  583B 64E0 AB8E 36DA A2A2

RE: timestamp error cant find class for type 1296

От:
"Sondaar, Roelof" <roelof.sondaar@scania.com>
Дата:
Hello,

I don't know about the test but I think I read something about it being
special.
The second case I think you wanted to use default. See example below.
Best regards,
Roelof
snlsor=> create table test2 (
snlsor-> id datetime primary key default now(),
snlsor-> fodder varchar(64)
snlsor-> );
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'test2_pkey'
for table 'test2'
CREATE
snlsor=> INSERT INTO test2 (fodder) VALUES ('arfarf');
INSERT 615427 1
snlsor=> select * from test2;
id                             |fodder
-------------------------------+------
Fri Mar 31 14:39:50 2000 METDST|arfarf
(1 row)
snlsor=> INSERT INTO test2 (fodder) VALUES ('arfarfgggg');
INSERT 615428 1
snlsor=> select * from test2;
id                             |fodder    
-------------------------------+----------
Fri Mar 31 14:39:50 2000 METDST|arfarf    
Fri Mar 31 14:43:31 2000 METDST|arfarfgggg
(2 rows)
> -----Original Message-----
> From:	crypt0genic [SMTP:crypt0genic@ecad.org]
> Sent:	vrijdag 31 maart 2000 13:14
> To:	pgsql-general@postgresql.org
> Subject:	[GENERAL] timestamp error cant find class for type 1296
> 
> 
> When attempting to create the following table:
> 
> CREATE TABLE test (
> 								id timestamp
> primary key,
> 								fodder
> varchar(64)
> 								);
> 
> 
> I get the following error:
> ERROR:  Can't fine a default operator CLASS for type 1296
> 
> Whats that all about? ;)
> 
> If I create the table as follows (which AFAIK is equivilant):
> ;								fodder
> varchar(64)
> 								);
> 
> It creates fine but when I try to insert something like:
> 
> INSERT INTO test2 (fodder) VALUES ('arfarf');
> 
> I get:
> ERROR: ExecAppend: Fail to add null value in not null value attribute id
> 
> I thought that the datetime field would be filled automatically on a
> insert with a current timestamp. can someone point out what Im doin wrong.
> 
> Thnx all,
> -crypt0genic
> 
> 
> 
> -- 
> Reverse engineering, the most fun and usually the most effective way
> to tackle a problem or learn something new.
> Public PGP key:		http://www.ecad.org/crypt0genic.pkr
> Fingerprint: 		A4F6 9F69 7C89 0AC0 9F9F  583B 64E0 AB8E 36DA A2A2

Re: timestamp error cant find class for type 1296

От:
Peter Eisentraut <e99re41@DoCS.UU.SE>
Дата:
You can't create an index on timestamp in <7.0 versions.

On Fri, 31 Mar 2000, crypt0genic wrote:

> 
> When attempting to create the following table:
> 
> CREATE TABLE test (
> 								id timestamp primary key,
> 								fodder varchar(64)
> 								);
> 
> 
> I get the following error:
> ERROR:  Can't fine a default operator CLASS for type 1296
> 
> Whats that all about? ;)
> 
> If I create the table as follows (which AFAIK is equivilant):
> CREATE TABLE test2 (
> 								id datetime primary key,
> 								fodder varchar(64)
> 								);
> 
> It creates fine but when I try to insert something like:
> 
> INSERT INTO test2 (fodder) VALUES ('arfarf');
> 
> I get:
> ERROR: ExecAppend: Fail to add null value in not null value attribute id
> 
> I thought that the datetime field would be filled automatically on a insert with a current timestamp. can someone point out what Im doin wrong.
> 
> Thnx all,
> -crypt0genic
> 
> 
> 
> 

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden

RE: timestamp error cant find class for type 1296

От:
"Sondaar, Roelof" <roelof.sondaar@scania.com>
Дата:
Hello Peter,

Can you explain this more in detail, because I fail to see the difference in
the following:

Welcome to the POSTGRESQL interactive sql monitor:
  Please read the file COPYRIGHT for copyright terms of POSTGRESQL
[PostgreSQL 6.5.3 on hppa1.1-hp-hpux10.20, compiled by cc -Ae ]

snlsor=> create table test2 ( id integer primary key);     
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'test2_pkey'
for table 'test2'
CREATE
snlsor=> create table test3 (id datetime primary key);
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'test3_pkey'
for table 'test3'
CREATE

Best regards,
Roelof


> -----Original Message-----
> From:	Peter Eisentraut [SMTP:e99re41@DoCS.UU.SE]
> Sent:	vrijdag 31 maart 2000 15:09
> To:	crypt0genic
> Cc:	pgsql-general@postgresql.org
> Subject:	Re: [GENERAL] timestamp error cant find class for type 1296
> 
> You can't create an index on timestamp in <7.0 versions.
> 
> On Fri, 31 Mar 2000, crypt0genic wrote:
> 
> > 
> > When attempting to create the following table:
> > 
> > CREATE TABLE test (
> > 								id timestamp
> primary key,
> > 								fodder
> varchar(64)
> > 								);
> > 
> > 
> > I get the following error:
> > ERROR:  Can't fine a default operator CLASS for type 1296
> > 
> > Whats that all about? ;)
> > 
> > If I create the table as follows (which AFAIK is equivilant):
> > CREATE TABLE test2 (
> > 								id datetime
> primary key,
> > 								fodder
> varchar(64)
> > 								);
> > 
> > It creates fine but when I try to insert something like:
> > 
> > INSERT INTO test2 (fodder) VALUES ('arfarf');
> > 
> > I get:
> > ERROR: ExecAppend: Fail to add null value in not null value attribute id
> > 
> > I thought that the datetime field would be filled automatically on a
> insert with a current timestamp. can someone point out what Im doin wrong.
> > 
> > Thnx all,
> > -crypt0genic
> > 
> > 
> > 
> > 
> 
> -- 
> Peter Eisentraut                  Sernanders väg 10:115
> peter_e@gmx.net                   75262 Uppsala
> http://yi.org/peter-e/            Sweden
FAQ