Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-es-ayuda by date

Next:From: juan jaimesDate: 2008-01-29 00:04:55
Subject: Re: campo money no presenta valores >1000
Previous:From: Alvaro HerreraDate: 2008-01-28 23:45:11
Subject: Re: [OT] Sugerencia para los administradores dela lista

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group