You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/11/08 10:13:49 UTC

[GitHub] [arrow-datafusion] Jimexist opened a new issue #1269: create mem table should be override current tables

Jimexist opened a new issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269


   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   
   With #1252 dropping supported, we should not override existing table with create table as statement.
   
   **Describe the solution you'd like**
   
   ### current behavior:
   
   ```
   ❯ create table users as values ('a', 'b');
   0 rows in set. Query took 0.001 seconds.
   ❯ create table users as values ('a', 'b');
   0 rows in set. Query took 0.001 seconds.
   ❯ \d
   +---------------+--------------------+------------+------------+
   | table_catalog | table_schema       | table_name | table_type |
   +---------------+--------------------+------------+------------+
   | datafusion    | public             | users      | BASE TABLE |
   | datafusion    | information_schema | tables     | VIEW       |
   | datafusion    | information_schema | columns    | VIEW       |
   +---------------+--------------------+------------+------------+
   3 rows in set. Query took 0.003 seconds.
   ```
   
   ### expecting
   
   statement to err on the second create.
   
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features you've considered.
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] xudong963 commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
xudong963 commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-967798062


   > I think this is a bug for management of table metadata. If the new table is not compatible or conflict with existing table, datafusion should throw error and provide error type.
   
   Yes, I agree, I tested in pg.
   FYI
   ```
   postgres=# create table users as values ('a', 'b');
   SELECT 1
   postgres=# create table users as values ('a', 'b');
   ERROR:  relation "users" already exists
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] Jimexist commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
Jimexist commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-967918066


   isn't that just about name conflict? no matter if the new schema is compatible or conflict with the existing one it shall not be allowed


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] liukun4515 commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-968059055


   we should forbid this in the SQL parse phase.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-968068360


   I suggest we support the postgres model here (it does not seem to have `create or replace table`)
   
   ```sql
   create table foo (...); -- errors if a table named foo already exists
   ```
   
   ```sql
   drop table foo (...); -- errors if the table does not already exists
   ```
   
   That way it is super clear that we aren't replacing tables and the user has to explicitly drop the existing one
   
   Bonus points for supporting `create table ... if not exists`, but perhaps as a follow on PR


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] liukun4515 commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-968069058


   > I suggest we support the postgres model here (it does not seem to have `create or replace table`)
   > 
   > ```sql
   > create table foo (...); -- errors if a table named foo already exists
   > ```
   > 
   > ```sql
   > drop table foo (...); -- errors if the table does not already exists
   > ```
   > 
   > That way it is super clear that we aren't replacing tables and the user has to explicitly drop the existing one
   > 
   > Bonus points for supporting `create table ... if not exists`, but perhaps as a follow on PR
   
   I can give another pull request to implement the `drop table foo` and `create table .... if not exists`


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] liukun4515 commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-966834617


   I think this is a bug for management of table metadata.
   If the new table is not compatible or conflict with existing table, datafusion should throw error and provide error type.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] roeap commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
roeap commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-966877416


   I'd be happy to give this a shot, but would need to understand the desired behaviour a bit better. i.e. should an error be returned only if the table is registered via the context, or should this be pushed down to the catalogue/schema level?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-963569189


   I think this would be a good first issue for someone who wanted to tackle it 
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] liukun4515 commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-968058888


   > isn't that just about name conflict? no matter if the new schema is compatible or conflict with the existing one it shall not be allowed
   
   Yes.
   In the user side, user should get the error message which can provide the error type.
   In the PG, db will give the error message like “table name already exists"


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb commented on issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-968068426


   Here is what postgres does:
   
   ```
   postgres=# create table foo(x int);
   CREATE TABLE
   
   postgres=# create table foo(x int);
   ERROR:  relation "foo" already exists
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb closed issue #1269: create mem table should not override current tables

Posted by GitBox <gi...@apache.org>.
alamb closed issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269


   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] Dandandan commented on issue #1269: create mem table should be override current tables

Posted by GitBox <gi...@apache.org>.
Dandandan commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-963002649


   Yes agree @Jimexist .
   Maybe we can also add support for `create or replace` to not error if it already exists.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] Jimexist commented on issue #1269: create mem table should be override current tables

Posted by GitBox <gi...@apache.org>.
Jimexist commented on issue #1269:
URL: https://github.com/apache/arrow-datafusion/issues/1269#issuecomment-963001047


   FYI @Dandandan 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org