Обсуждение: Re: Getting Metadata

Поиск
Список
Период
Сортировка

Re: Getting Metadata

От
"matt"
Дата:
That is how do i access pg_attribute within a program?

Also, are the columns stored in order within pg_attribute?

thanks
matt



Re: Getting Metadata

От
Roberto Mello
Дата:
On Thu, Apr 18, 2002 at 07:47:04PM -0500, matt wrote:
> That is how do i access pg_attribute within a program?

With a regular SELECT.

> Also, are the columns stored in order within pg_attribute?

Go into psql and type "\d pg_attribute" like any other table.

If you want to see how psql does its internal queries (e.g. when you
run '\d table') run psql with the -E switch.

-Roberto

--
+----| http://fslc.usu.edu/ USU Free Software & GNU/Linux Club |------+
  Roberto Mello - Computer Science, USU - http://www.brasileiro.net/
       http://www.sdl.usu.edu/ - Space Dynamics Lab, Developer
Newsbytes - Microsoft announce EDLIN for Windows.

Re: Internal Query

От
"matt"
Дата:
So, to do an internal query, I can just do:

char * query = "SELECT column from pg_attributes WHERE pg_attributes.table =
table_name";

PGresult   *result; <--where is PGresult stored?? what do i need to include
to get this struct?
result = PSQLexec(query);

What's the difference between PSQLexec and pg_exec?

And then, how do i access the information?  I see commands like pg_result in
src/interfaces/libpgtcl/pgtclCmds.c but are these backend commands that I do
run inside a given function?  the pg_stuff looks almost like front end
stuff...

sincerly,
matt