erro do timestamp no postgreSQL????
Olá pessoal,
Estou criando uma tabela para o servidor postfix, e está me dando o seguinte erro:
postfix=# CREATE TABLE "admin" (
postfix(# "username" character varying (255) NOT NULL,
postfix(# "password" character varying (255) NOT NULL,
postfix(# "created" timestamp(13) with time zone DEFAULT '1999-04-23 01:05:06',
postfix(# "modified" timestamp(13) with time zone '1999-04-23 01:05:06',
postfix(# "active" boolean default true,
postfix(# Constraint "admin_key" Primary Key ("username")
postfix(# );
WARNING: TIMESTAMP(13) WITH TIME ZONE precision reduced to maximum allowed, 6
WARNING: TIMESTAMP(13) WITH TIME ZONE precision reduced to maximum allowed, 6
ERROR: syntax error at or near "'1999-04-23 01:05:06'" at character 224
LINE 5: "modified" timestamp(13) with time zone '1999-04-23 01:05:06...
o que pode ser?
Re: erro do timestamp no postgreSQL????
Acho que o problema é que você definiu a coluna com tamanho de 13 e está pedindo que ela tenha uma definição maior...
tente cria-la sem tamanho definido.
Re: erro do timestamp no postgreSQL????
oi,
tente simplesmente TIMESTAMP
flw
Re: erro do timestamp no postgreSQL????
acho q vc tem q converter pra timestamp, pq '1999-04-23 01:05:06' é string, eu acho.
tenta '1999-04-23 01:05:06'::timestamp
flw
Re: erro do timestamp no postgreSQL????
Oi amigo tomelin,
vc pode perceber que ele não ta nem encrencando com o timestamp em si, pois ele só da um warning dizendo que o limite máximo permido é 6, e q ele ta reduzindo pra 6.
Mas o que ta parecendo errado mesmo é a linha:
"modified" timestamp(13) with time zone '1999-04-23 01:05:06',
Se vc alterar para:
CREATE TABLE "admin" (
"username" character varying (255) NOT NULL,
"password" character varying (255) NOT NULL,
"created" timestamp(13) with time zone DEFAULT '1999-04-23 01:05:06',
"modified" timestamp(13) with time zone DEFAULT '1999-04-23 01:05:06',
"active" boolean default true,
Constraint "admin_key" Primary Key ("username")
);
ou mesmo para:
CREATE TABLE "admin" (
"username" character varying (255) NOT NULL,
"password" character varying (255) NOT NULL,
"created" timestamp(6) with time zone DEFAULT '1999-04-23 01:05:06',
"modified" timestamp(6) with time zone DEFAULT '1999-04-23 01:05:06',
"active" boolean default true,
Constraint "admin_key" Primary Key ("username")
);
ele não deve mais dar erro.
Espero que te ajude.
Falou