how to retrieve table definition - Mailing list pgsql-novice

From Raimon Fernandez
Subject how to retrieve table definition
Date
Msg-id 5D4483B0-E556-4C2E-A545-49278F5F752B@montx.com
Whole thread Raw
In response to Ocaml as a Postgresql Procedural Language?  (Brian Hurt <bhurt@janestcapital.com>)
Responses Re: how to retrieve table definition
List pgsql-novice
Hi,

In sqlite with SELECT * FROM sqlite_master WHERE table='a' I can
obtain the complete CREATE TABLE ... commands,


Wich is the equivalent in PostgeSQL ? I've been trying
information_schema.tables without success ...


thanks!


raimon fernandez



for example:

for table 'comptes' I want to retrieve this:

create table public.comptes( "codi_empresa" char(2) not null ,
"codi_compte" varchar not null , "comptes" varchar not null , "tipus"
char(2) not null , "clau_compte" char(13) not null , "saldo_deure"
numeric(12,2) not null , "saldo_haver" numeric(12,2) not null ,
"nivell" int2 not null , "saldo" numeric(12,2) not null ,
"ultim_moviment" date not null , "codi_437" int2 not null
)
  WITH OIDS;
ALTER table "public"."comptes" OWNER TO "postgres";
ALTER table "public"."comptes" SET WITHOUT CLUSTER;
alter table "public"."comptes" add primary key(clau_compte);
create index "clau_compte1" on "public"."comptes" using btree
(clau_compte) ;
create index "comptes1" on "public"."comptes" using btree(comptes) ;
create index "nivell" on "public"."comptes" using btree(nivell) ;



pgsql-novice by date:

Previous
From: John DeSoi
Date:
Subject: Re: Invalid byte sequence for encoding "UTF8"
Next
From: "Programmer"
Date:
Subject: Re: how to retrieve table definition