LucidDB / luciddb

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

[FRG-250] misleading error message for call to UDX with column list but mismatched parameter count #622

Closed dynamobi-build closed 12 years ago

dynamobi-build commented 12 years ago

[reporter="jvs", created="Sat, 20 Jan 2007 13:22:41 -0500 (GMT-05:00)"] select schema_name, crc_value from table(
applib.generate_crc(
          cursor(select * from sys_root.dba_schemas),
          row(creator)
      )
);

gives

Error: From line 4, column 14 to line 4, column 20: Unknown identifier 'CREATOR' (state=,code=0)

but with the correct three-arg invocation, it works:

select schema_name, crc_value from table(
applib.generate_crc(
          cursor(select * from sys_root.dba_schemas),
          row(creator),
          true
      )
);

dynamobi-build commented 12 years ago

[author="zfong", created="Sun, 21 Jan 2007 15:01:53 -0500 (GMT-05:00)"] The misleading error results because I first try to find a UDX where the row() parameter corresponds to a UDX column list parameter. If that fails, then I treat the row() expression as a real row expression and try finding a UDX that takes a row expression parameter. But while trying to validate the row expression, the validator tries to look for column name "creator" in the outer query, which doesn't exist. Hence, the error.

Although we currently don't support actual row expressions passed into UDX's, I did what I've described above, in the event that we do support it in the future.

I can certainly take that part out and just return a signature not matched type error, if I don't find an appropriate UDX matching the incorrect signature. And then when we do support row parameters in UDX's, deal with the issue then.

dynamobi-build commented 12 years ago

[author="jvs", created="Sun, 21 Jan 2007 16:15:27 -0500 (GMT-05:00)"] Instead of overloading ROW, I should probably have just introduced a new COLUMN_LIST keyword.

The SQL:2003 rules in SqlUtil.lookupSubjectRoutines provide a possible solution: first filter by number of parameters before looking at the argument types.

dynamobi-build commented 12 years ago

[author="zfong", created="Mon, 22 Jan 2007 15:29:06 -0500 (GMT-05:00)"] Fixed checked into Eigenchange 8566. Also, includes fix for FRG-251.

Fixed this bug by doing what John suggested. If resolving the ROW() parameter as column list reference fails, only try resolving the ROW() parameter as a ROW expression if we know we have some routine that matches the specified routine name with the specified number of arguments.