Re: is there a 'table' data type in pg?

Поиск
Список
Период
Сортировка
От Louis-David Mitterrand
Тема Re: is there a 'table' data type in pg?
Дата
Msg-id 20070724142328.GA25489@apartia.fr
обсуждение исходный текст
Ответ на Re: is there a 'table' data type in pg?  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: is there a 'table' data type in pg?  ("Peter Childs" <peterachilds@gmail.com>)
Список pgsql-sql
On Tue, Jul 24, 2007 at 03:10:44PM +0100, Gregory Stark wrote:
> "Louis-David Mitterrand" <vindex+lists-pgsql-sql@apartia.org> writes:
> 
> > Can I use a another column to store the type of the id_subject (ie: the 
> > tabled it belongs to) ? Then I would be able to query that table for 
> > additional info to print alongside the forum posts.
> 
> There are ways to identifier tables in Postgres but there's no way to run a
> query against a table using them.

Bummer, I suspected as much.

> I would strongly recommend you define your own list of "object_types",
> probably even have an object_type table with a primary key, a description
> column, and a table_name column. Then you can in your application construct
> the appropriate query depending on the object_type. 

Good fallback solution.

> One alternative you could do is have a set-returning plpgsql function which
> has a big if statement and performs the right kind of query. I think the
> records would have to all be the same -- they can't be different kinds of
> records depending on the type of object.

Will look at that one, always willing to dig deeper into pg's more 
complex ways :)

Thanks for your help,


В списке pgsql-sql по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: is there a 'table' data type in pg?
Следующее
От: "Peter Childs"
Дата:
Сообщение: Re: is there a 'table' data type in pg?