Thread: FDW table hints
postgres=# DROP TABLE FOO; ERROR: "foo" is not a table HINT: Use DROP FOREIGN TABLE to remove a foreign table. postgres=# CREATE INDEX baz ON foo(bar); ERROR: "foo" is not a table To some, that would be confusing - foo kind of is a table, just a different kind. Should we have some HINT on that one as well? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
On Mon, May 02, 2011 at 09:27:08PM +0200, Magnus Hagander wrote: > postgres=# DROP TABLE FOO; > ERROR: "foo" is not a table > HINT: Use DROP FOREIGN TABLE to remove a foreign table. > postgres=# CREATE INDEX baz ON foo(bar); > ERROR: "foo" is not a table > > To some, that would be confusing - foo kind of is a table, just a > different kind. Should we have some HINT on that one as well? Until we can actually create indexes on foreign tables, yes ;) Cheers, David (Local indexes? Foreign indexes? Both?) -- David Fetter <david@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
On Mon, May 2, 2011 at 23:56, David Fetter <david@fetter.org> wrote: > On Mon, May 02, 2011 at 09:27:08PM +0200, Magnus Hagander wrote: >> postgres=# DROP TABLE FOO; >> ERROR: "foo" is not a table >> HINT: Use DROP FOREIGN TABLE to remove a foreign table. >> postgres=# CREATE INDEX baz ON foo(bar); >> ERROR: "foo" is not a table >> >> To some, that would be confusing - foo kind of is a table, just a >> different kind. Should we have some HINT on that one as well? > > Until we can actually create indexes on foreign tables, yes ;) Well, yeah, but I don't think we can squeeze that into 9.1 without Robert noticing :P Any suggestions on *what* the hint should be? Just something along the line "indexes cannot be created on foreign tables"? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
On 03.05.2011 09:30, Magnus Hagander wrote: > Well, yeah, but I don't think we can squeeze that into 9.1 without > Robert noticing :P > > Any suggestions on *what* the hint should be? Just something along the > line "indexes cannot be created on foreign tables"? Magnus, I am not really sure if this is clever. When we make such a hint for foreign tables then we should make a similar hint for views. Just my 2ct, Susanne -- Susanne Ebrecht - 2ndQuadrant PostgreSQL Development, 24x7 Support, Training and Services www.2ndQuadrant.com
On Tue, May 3, 2011 at 10:33 AM, Susanne Ebrecht <susanne@2ndquadrant.com> wrote: > On 03.05.2011 09:30, Magnus Hagander wrote: >> >> Well, yeah, but I don't think we can squeeze that into 9.1 without >> Robert noticing :P >> >> Any suggestions on *what* the hint should be? Just something along the >> line "indexes cannot be created on foreign tables"? > > Magnus, > > I am not really sure if this is clever. > > When we make such a hint for foreign tables then we should make a similar > hint for views. A view really isn't a table, unlike a foreign table, so I don't think that argument holds. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
On Tue, May 03, 2011 at 10:42:30AM +0100, Dave Page wrote: > On Tue, May 3, 2011 at 10:33 AM, Susanne Ebrecht > <susanne@2ndquadrant.com> wrote: > > On 03.05.2011 09:30, Magnus Hagander wrote: > >> > >> Well, yeah, but I don't think we can squeeze that into 9.1 without > >> Robert noticing :P > >> > >> Any suggestions on *what* the hint should be? Just something along the > >> line "indexes cannot be created on foreign tables"? > > > > Magnus, > > > > I am not really sure if this is clever. > > > > When we make such a hint for foreign tables then we should make a > > similar hint for views. > > A view really isn't a table, unlike a foreign table, so I don't > think that argument holds. There are other systems where it's possible to constrain VIEWs, something we might approach with an index. One of those systems comes from some outfit in Redwood Shores, California with cylindrical buildings, so it's not as wild as it first appears. Anyhow: +1 for mentioning that at the moment, it's not possible to create an index on a foreign table. +1 also for doing this with VIEWs, but as a separate patch. Cheers, David. -- David Fetter <david@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
Dave Page <dpage@pgadmin.org> writes: > On Tue, May 3, 2011 at 10:33 AM, Susanne Ebrecht > <susanne@2ndquadrant.com> wrote: >> When we make such a hint for foreign tables then we should make a similar >> hint for views. > A view really isn't a table, unlike a foreign table, so I don't think > that argument holds. Well, from the implementation standpoint a foreign table is a lot more like a view than it is like a table. I think the real point is that a hint for this on views would be a waste of translator manpower, because we've not heard of anyone making that mistake. regards, tom lane
On Tue, May 3, 2011 at 16:19, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Dave Page <dpage@pgadmin.org> writes: >> On Tue, May 3, 2011 at 10:33 AM, Susanne Ebrecht >> <susanne@2ndquadrant.com> wrote: >>> When we make such a hint for foreign tables then we should make a similar >>> hint for views. > >> A view really isn't a table, unlike a foreign table, so I don't think >> that argument holds. > > Well, from the implementation standpoint a foreign table is a lot more > like a view than it is like a table. I think the real point is that a > hint for this on views would be a waste of translator manpower, because > we've not heard of anyone making that mistake. The *implementation* is in this case, IMHO; irrelevant. The relevant part is what it looks like to the *user*, and to the user a foreign table looks a lot more like a table than a view does. Since I brought it up - a patch along this line? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
Attachment
Magnus Hagander <magnus@hagander.net> writes: > Since I brought it up - a patch along this line? Please don't capitalize "foreign table" there. Also, I think an "else" before the other ereport would make the code clearer, even though it's not strictly necessary. regards, tom lane
On Thu, May 5, 2011 at 19:22, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Magnus Hagander <magnus@hagander.net> writes: >> Since I brought it up - a patch along this line? > > Please don't capitalize "foreign table" there. Yeah, I was a bit split about that myself. Will change. > Also, I think an "else" before the other ereport would make the code > clearer, even though it's not strictly necessary. Agreed. Unless someone objects, I'll go put that in later tonight. (along with a comment on why there are two different msgs) -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
On Thu, May 5, 2011 at 19:26, Magnus Hagander <magnus@hagander.net> wrote: > On Thu, May 5, 2011 at 19:22, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> Magnus Hagander <magnus@hagander.net> writes: >>> Since I brought it up - a patch along this line? >> >> Please don't capitalize "foreign table" there. > > Yeah, I was a bit split about that myself. Will change. > > >> Also, I think an "else" before the other ereport would make the code >> clearer, even though it's not strictly necessary. > > Agreed. > > Unless someone objects, I'll go put that in later tonight. (along with > a comment on why there are two different msgs) > Done. -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/