On Tue, May 3, 2011 at 16:19, Tom Lane <[email protected]> wrote:
> Dave Page <[email protected]> writes:
>> On Tue, May 3, 2011 at 10:33 AM, Susanne Ebrecht
>> <[email protected]> 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/
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index ff84045..e3d902e 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -183,10 +183,18 @@ DefineIndex(RangeVar *heapRelation,
/* Note: during bootstrap may see uncataloged relation */
if (rel->rd_rel->relkind != RELKIND_RELATION &&
rel->rd_rel->relkind != RELKIND_UNCATALOGED)
+ {
+ if (rel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot create index on FOREIGN TABLE \"%s\"",
+ heapRelation->relname)));
+
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a table",
heapRelation->relname)));
+ }
/*
* Don't try to CREATE INDEX on temp tables of other backends.
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers