Обсуждение: relkind check in info.c

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

relkind check in info.c

От
Alvaro Herrera
Дата:
Hi,

I see that PGAPI_Tables() has a relkind check that only seems to include
tables and views.  Does it make sense to have it consider materialized
views as well?

I don't know anything about psqlodbc -- I'm just going by a question in
the spanish list:
http://www.postgresql.org/message-id/53287159.7040009@gmail.com

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


Re: relkind check in info.c

От
Michael Paquier
Дата:
On Wed, Mar 19, 2014 at 3:39 AM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> Hi,
>
> I see that PGAPI_Tables() has a relkind check that only seems to include
> tables and views.  Does it make sense to have it consider materialized
> views as well?
>
> I don't know anything about psqlodbc -- I'm just going by a question in
> the spanish list:
> http://www.postgresql.org/message-id/53287159.7040009@gmail.com

Yeah, it would make sense to list it by adding 'm' to the relkind
queries. I am noting as well that we should list it when invocating
SQL_ALL_TABLE_TYPES. A patch to do that is simple, and not worth an
additional regression test IMO, just to avoid the pain to have
version-related regression tests...

Regards,
--
Michael


Re: relkind check in info.c

От
Michael Paquier
Дата:
On Wed, Mar 19, 2014 at 8:07 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Wed, Mar 19, 2014 at 3:39 AM, Alvaro Herrera
> <alvherre@2ndquadrant.com> wrote:
>> Hi,
>>
>> I see that PGAPI_Tables() has a relkind check that only seems to include
>> tables and views.  Does it make sense to have it consider materialized
>> views as well?
>>
>> I don't know anything about psqlodbc -- I'm just going by a question in
>> the spanish list:
>> http://www.postgresql.org/message-id/53287159.7040009@gmail.com
>
> Yeah, it would make sense to list it by adding 'm' to the relkind
> queries. I am noting as well that we should list it when invocating
> SQL_ALL_TABLE_TYPES. A patch to do that is simple, and not worth an
> additional regression test IMO, just to avoid the pain to have
> version-related regression tests...
Just adding that a similar thing should be done with foreign tables.
--
Michael


Re: relkind check in info.c

От
Heikki Linnakangas
Дата:
On 03/19/2014 01:17 AM, Michael Paquier wrote:
> On Wed, Mar 19, 2014 at 8:07 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
>> On Wed, Mar 19, 2014 at 3:39 AM, Alvaro Herrera
>> <alvherre@2ndquadrant.com> wrote:
>>> Hi,
>>>
>>> I see that PGAPI_Tables() has a relkind check that only seems to include
>>> tables and views.  Does it make sense to have it consider materialized
>>> views as well?
>>>
>>> I don't know anything about psqlodbc -- I'm just going by a question in
>>> the spanish list:
>>> http://www.postgresql.org/message-id/53287159.7040009@gmail.com
>>
>> Yeah, it would make sense to list it by adding 'm' to the relkind
>> queries. I am noting as well that we should list it when invocating
>> SQL_ALL_TABLE_TYPES. A patch to do that is simple, and not worth an
>> additional regression test IMO, just to avoid the pain to have
>> version-related regression tests...
> Just adding that a similar thing should be done with foreign tables.

We need to decide to what to return in the table_type column for them.
"FOREIGN TABLE" and "MATERIALIZED VIEW" would be natural choices.

But it would be good to return the same string that other DBMS's return
for those things. What does SQL Server's driver return for materialized
views? I'm not aware of any other DBMS that implements foreign tables
per the spec, but e.g DB2 has "remote tables" and Oracle has "database
links", which are similar features. I wonder what table type do they return.

- Heikki


Re: relkind check in info.c

От
Michael Paquier
Дата:
On Wed, May 14, 2014 at 10:46 PM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:
> We need to decide to what to return in the table_type column for them.
> "FOREIGN TABLE" and "MATERIALIZED VIEW" would be natural choices.
This choice makes sense.

> But it would be good to return the same string that other DBMS's return for
> those things. What does SQL Server's driver return for materialized views?
> I'm not aware of any other DBMS that implements foreign tables per the spec,
> but e.g DB2 has "remote tables" and Oracle has "database links", which are
> similar features. I wonder what table type do they return.
Poking a little bit that, I finished with the patch attached, with
some regression tests attached. It may not be the most beautiful patch
ever, but it is consistent with the current way code is made and it
has the merit to be simple.
Regards,
--
Michael

Вложения