Re: Comando "describe"

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "felipe fernandez" <ffdez(at)auna(dot)com>
Cc: Postgresql <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Comando "describe"
Date: 2008-01-28 23:58:26
Message-ID: c2d9e70e0801281558j106c8583w395061cb2668d0ed@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

2008/1/28 felipe fernandez <ffdez(at)auna(dot)com>:
> Buscando en cakephp he encontrado la query que resuelve mis problemas
>
> SELECT DISTINCT column_name AS name, data_type AS type, is_nullable AS
> null, column_default AS default, ordinal_position AS position,
> character_maximum_length AS char_length, character_octet_length AS
> oct_length FROM information_schema.columns WHERE table_name ='tabla'
> ORDER BY position"
>

pongamoslo a prueba ejecuta lo siguiente:

CREATE TABLE public.cuenta_contable
(
empresa smallint NOT NULL,
codigo text NOT NULL,
descripcion text NOT NULL,
nivel1 smallint NOT NULL,
tipo_cuenta character(1) NOT NULL,
tipo_estado_financiero character(1) NOT NULL,
CONSTRAINT cuenta_contable_pkey PRIMARY KEY (codigo, empresa)
);

CREATE SCHEMA contabilidad;

CREATE TABLE contabilidad.cuenta_contable
(
empresa smallint NOT NULL,
codigo text NOT NULL,
descripcion text NOT NULL,
nivel smallint NOT NULL,
tipo_cuenta character(1) NOT NULL,
tipo_estado_financiero character(1) NOT NULL,
CONSTRAINT cuenta_contable_pkey PRIMARY KEY (codigo, empresa)
);

Ahora ejecuta tu query y mira lo que ocurre... (mejor usa el que te da psql -E)

--
Atentamente,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message juan jaimes 2008-01-29 00:04:55 Re: campo money no presenta valores >1000
Previous Message Alvaro Herrera 2008-01-28 23:45:11 Re: [OT] Sugerencia para los administradores de la lista