Getting a list of fields in a table... 
Author Message
 Getting a list of fields in a table...
I'm looking for a solution to getting the fields in a table without
running some random query on the system, can anyone share
the SQL with me to get this done and anything special that would
need to be done with libpq would also be appreciated...


Fri, 17 Oct 2003 18:38:36 GMT
 Getting a list of fields in a table...

Quote:
> I'm looking for a solution to getting the fields in a table without
> running some random query on the system, can anyone share
> the SQL with me to get this done and anything special that would
> need to be done with libpq would also be appreciated...

Dear Rich:

        Sorry this isn't a complete answer.  If you really need SQL
(rather than \d inside psql) there is a way to find out the SQL commands
psql uses to perform its special commands.  This subject has been on
the newsgroup in the "recent past" -- sorry, don't have anything exact.
Alternatively you can invoke psql with a shell script, something like:
        psql -s <database name> -t <table name>
which will cause the schema to be sent to stdout.  I'm not sure what
you want to do via libpq, though once you have the SQL strings you could
use any number of methods to access the schema.

Hope this helps!

        -frank

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Wed, 22 Oct 2003 09:09:34 GMT
 Getting a list of fields in a table...
Use psql -E, that will show you the queries the commands generate (try \d
<tablename> and check out the query)..

-Mitch

Quote:
----- Original Message -----



Sent: Friday, May 04, 2001 8:20 PM
Subject: Re: Getting a list of fields in a table...

> > I'm looking for a solution to getting the fields in a table without
> > running some random query on the system, can anyone share
> > the SQL with me to get this done and anything special that would
> > need to be done with libpq would also be appreciated...

> Dear Rich:

> Sorry this isn't a complete answer.  If you really need SQL
> (rather than \d inside psql) there is a way to find out the SQL commands
> psql uses to perform its special commands.  This subject has been on
> the newsgroup in the "recent past" -- sorry, don't have anything exact.
> Alternatively you can invoke psql with a shell script, something like:
> psql -s <database name> -t <table name>
> which will cause the schema to be sent to stdout.  I'm not sure what
> you want to do via libpq, though once you have the SQL strings you could
> use any number of methods to access the schema.

> Hope this helps!

> -frank

> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?

> http://www.postgresql.org/users-lounge/docs/faq.html

---------------------------(end of broadcast)---------------------------




Wed, 22 Oct 2003 09:14:11 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Getting a list of Tables and fields in an access database

2. Problem getting list of fields in table

3. getting list of fields from recordset

4. Getting a list of items on a report with summary fields

5. Getting a list of all replicated tables?

6. Getting list of columns in a table

7. Getting a list of Tables using Borland C++ Builder 5/MS SQL Server 8

8. getting oracle tables list

9. getting a list of table names

10. Getting a list of Tables

11. Getting a list of tables in a database with Perl

12. Getting a list of available tables in an Access file


 
Powered by phpBB® Forum Software