treasure-data / prestogres

PostgreSQL protocol gateway for Presto distributed SQL query engine
Other
292 stars 61 forks source link

empty string/varchar(0) cause error #46

Closed wyukawa closed 6 years ago

wyukawa commented 8 years ago

Hi

I use presto 0.145.

Presto 0.145 treats empty string as varchar(0).

create view test as select '' as hoge from ...
presto:default> desc test;
 Column |    Type    | Comment
--------+------------+---------
 hoge   | varchar(0) |
(1 row)

But because postgresql doesn't seem to allow varchar(0), the following prestogres error occurs.

HINT:  BACKEND Error: "ERROR:  spiexceptions.InvalidParameterValue: length for type varchar must be at least 1 at character 238

Workaround is to use cast('' as varchar)

But presto 0.143 treats empty string as varchar. So maybe this problem doesn't occur at 0.143.

But important problem is that there is no isolation.

If user create varchar(0) presto view at 0.145, prestogres doesn't response at all.

Althought this problem may not be prestogres's problem, I report because this information seems to be helpful.

Thanks