alamb commented on issue #13124:
URL: https://github.com/apache/datafusion/issues/13124#issuecomment-2439553160

   @jayzhan211  notes 
https://github.com/apache/datafusion/pull/12864#issuecomment-2437192214
   
   > It seems the query is accidentally correct in before this change, because 
we don't know the result of the function when we build up Values plan. After 
this change, incorrect values ('abcd') is cast to column a instead of the 
result of the function.
   > 
   > The ideally solution is to find the result type of the function and check 
whether it matches the column type.
   > 
   > btw, I wonder is this query valid in postgres or elsewhere?
   > 
   > Valid query in postgres `CREATE TABLE t AS SELECT length(a)::int AS a FROM 
(VALUES ('+123')) t(a);`
   > 
   > Invalid query in postgres `CREATE TABLE t (a int) AS SELECT length(a)::int 
AS a FROM (VALUES ('+123')) t(a);`
   > 
   > ```
   > ERROR:  syntax error at or near "AS"
   > LINE 1: CREATE TABLE t(a int) AS SELECT length(a)::int AS a FROM (VA...
   > ```
   > 
   > It seems there is no way to insert value together with table if the column 
type is defined 🤔
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to