Table definition
am 16.11.2004 15:04:26 von BP
This is a multi-part message in MIME format.
------=_NextPart_000_02A9_01C4CBBB.4611EFC0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Les consultants Interaction | stationery
Hi,
Anybody know how to obtain the table definition in text.
Something like "select definition from pg_catalog.pg_views where =
viewname =3D 'xxx'" but for a table.
Thanks
Bruno
------=_NextPart_000_02A9_01C4CBBB.4611EFC0
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
ï»=BF
Les consultants Interaction | stationery
charset=3Dutf-8">
href=3D"file://C:\Documents and Settings\bruno.INTERACTION\Application =
Data\Microsoft\Stationery\">
Hi,
Anybody know how to obtain the table definition in text.
Something like "select definition from pg_catalog.pg_views where =
viewname =
'xxx'" but for a table.
Thanks
Bruno
------=_NextPart_000_02A9_01C4CBBB.4611EFC0--
Re: Table definition
am 16.11.2004 16:07:21 von gparuchuri
This is a multi-part message in MIME format.
------_=_NextPart_001_01C4CBED.F8C958B5
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Probably there is no direct way get the definition (i could not find one at=
least).
You can probably write a custom function which gives all columns, indexes a=
nd formulate a create table statement (text definition).
=20
Let us know if you find a way out.
=20
- Goutam
=20
________________________________
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.or=
g] On Behalf Of Bruno Pr=E9vost
Sent: Tuesday, November 16, 2004 9:04 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] Table definition
=09
=09
=20
Hi,
Anybody know how to obtain the table definition in text.
Something like "select definition from pg_catalog.pg_views where viewname =
=3D 'xxx'" but for a table.
Thanks
Bruno
=20
Confidentiality Notice
The information contained in this e-mail is confidential and intended for u=
se only by the person(s) or organization listed in the address. If you have=
received this communication in error, please contact the sender at O'Neil =
& Associates, Inc., immediately. Any copying, dissemination, or distributio=
n of this communication, other than by the intended recipient, is strictly =
prohibited.
------_=_NextPart_001_01C4CBED.F8C958B5
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Les consultants Interaction | stationery
>
href=3D"file://C:\Documents and Settings\bruno.INTERACTION\Application Data=
\Microsoft\Stationery\">
rial=20
color=3D#0000ff size=3D2>Probably there is no direct way get the definition=
(i could=20
not find one atleast).
rial=20
color=3D#0000ff size=3D2>You can probably write a custom function which giv=
es all=20
columns, indexes and formulate a create table statement (text=20
definition).
rial=20
color=3D#0000ff size=3D2>
rial=20
color=3D#0000ff size=3D2>Let us know if you find a way out.
AN>
rial=20
color=3D#0000ff size=3D2>
color=3D#0000ff>- Goutam
class=3D267470515-16112004>
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px soli=
d; MARGIN-RIGHT: 0px">
Hi,
Anybody know how to obtain the table definition in text.
Something like "select definition from pg_catalog.pg_views where vie=
wname=20
=3D 'xxx'" but for a table.
Thanks
Bruno
Confidentiality Notice
The information contained in this e-mail is confidential and intended for u=
se only by the person(s) or organization listed in the address. If you have=
received this communication in error, please contact the sender at O'Neil =
& Associates, Inc., immediately. Any copying, dissemination, or distributio=
n of this communication, other than by the intended recipient, is strictly =
prohibited.
------_=_NextPart_001_01C4CBED.F8C958B5--
Re: Table definition
am 16.11.2004 16:16:48 von peter_e
Am Dienstag, 16. November 2004 15:04 schrieb Bruno Prévost:
> Anybody know how to obtain the table definition in text.
Use pg_dump.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
Re: Table definition
am 16.11.2004 16:29:23 von Sam
Bruno Prévost wrote:
>Anybody know how to obtain the table definition in text.
Not quite sure if this is quite what you're after, but would:
$ pg_dump -st foo
help at all? It gives out the SQL that you would need to enter to
re-create the table.
Sam
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
Re: Table definition
am 16.11.2004 16:40:03 von BP
I need to use it in sql.
Thk
Bruno
----- Original Message -----
From: "Peter Eisentraut"
To: "Bruno Prévost"
Cc:
Sent: Tuesday, November 16, 2004 10:16 AM
Subject: Re: [SQL] Table definition
> Am Dienstag, 16. November 2004 15:04 schrieb Bruno Prévost:
>> Anybody know how to obtain the table definition in text.
>
> Use pg_dump.
>
> --
> Peter Eisentraut
> http://developer.postgresql.org/~petere/
>
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
Re: Table definition
am 16.11.2004 17:13:34 von peter_e
Am Dienstag, 16. November 2004 16:40 schrieb Bruno Prévost:
> I need to use it in sql.
There is no direct way to do this in SQL, but I can offer you the following
alternative:
CREATE FUNCTION get_table_definition(text) RETURNS text AS '
#!/bin/sh
pg_dump -t $1
' LANGUAGE plsh;
:)
--
Peter Eisentraut
http://developer.postgresql.org/~petere/
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
Re: Table definition
am 16.11.2004 17:49:11 von BP
It could help me, but pg_dump give all foreigns key and index creation.
I'm not sure if it's not better to write a custom function in plpgsql.
Bruno
----- Original Message -----
From: "Peter Eisentraut"
To: "Bruno Prévost"
Cc:
Sent: Tuesday, November 16, 2004 11:13 AM
Subject: Re: [SQL] Table definition
> Am Dienstag, 16. November 2004 16:40 schrieb Bruno Prévost:
>> I need to use it in sql.
>
> There is no direct way to do this in SQL, but I can offer you the
> following
> alternative:
>
> CREATE FUNCTION get_table_definition(text) RETURNS text AS '
> #!/bin/sh
> pg_dump -t $1
> ' LANGUAGE plsh;
>
> :)
>
> --
> Peter Eisentraut
> http://developer.postgresql.org/~petere/
>
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)