LucidDB / luciddb

DEFUNCT: See README
https://github.com/LucidDB/luciddb
Apache License 2.0
53 stars 24 forks source link

[FRG-297] cannot create method within udt without calling SET SCHEMA first #575

Closed dynamobi-build closed 12 years ago

dynamobi-build commented 12 years ago

[reporter="jhyde", created="Sat, 29 Sep 2007 23:39:03 -0500 (GMT-05:00)"] Cannot create method within a user-defined type you have not called SET SCHEMA first.

For example,

CREATE SCHEMA ddlgen;
CREATE TYPE ddlgen.playing_card AS (
card_suit char(1),
card_rank integer
) FINAL
CONSTRUCTOR METHOD ddlgen.playing_card.playing_card (
card_suit_init char(1),card_rank_init integer)
RETURNS ddlgen.playing_card
SELF AS RESULT
CONTAINS SQL
SPECIFIC ddlgen.playing_card;
Error: org.eigenbase.sql.parser.SqlParseException: No default schema specified; execute SET SCHEMA or use fully qualified names (state=,code=0)

It's possible that this is intentional in the UDT spec, or I don't understand the METHOD DDL syntax.

Note that method name is parsed using SimpleIdentifier() so it is impossible to pass in the schema name as part of the method name.

Please remove 'set schema ddlgen' from allTypes.sql when this bug is fixed.

dynamobi-build commented 12 years ago

[author="jvs", created="Sun, 30 Sep 2007 20:31:11 -0500 (GMT-05:00)"] Confirmed: this is a bug. It doesn't seem to be passing down the schema from the CREATE TYPE as it should. You should not need any of the qualifiers inside of the METHOD definition (nor are they legal).

dynamobi-build commented 12 years ago

[author="jvs", created="Sat, 6 Oct 2007 19:12:06 -0500 (GMT-05:00)"] I'm fixing this, and will add unit tests in unitsql/ddl/udt.sql. Where is allTypes.sql?

For the RETURNS clause, I'm not sure whether a qualifier should be required on the type. The spec says for a constructor, it must match the type name, but doesn't say whether the schema should be implied if none is specified. I'm assuming not, since the set path notion is well-defined; so either set path has to have been issued, or an explicit qualifier has to be supplied.

dynamobi-build commented 12 years ago

[author="jhyde", created="Sat, 6 Oct 2007 22:53:57 -0500 (GMT-05:00)"] I checked in allTypes.sql under a different name - farrago/unitsql/ddl/ddlgen.sql.

Since I logged that bug, I changed the DDL generator to not generate a RETURNS clause for a constructor method. So the return type of a constructor doesn't matter too much.

I am still fixing some problems with that test and FarragoDdlGeneratorTest - the test passes, but the catalog leak check is failing. So don't integrate to //open/dev yet.

dynamobi-build commented 12 years ago

[author="jvs", created="Sun, 7 Oct 2007 17:18:44 -0500 (GMT-05:00)"] Fix checked in on lu/dev in eigenchange 9966.