[MDEV-6708] OR REPLACE -> IF NOT EXISTS Created: 2014-09-07  Updated: 2015-03-05  Resolved: 2015-03-05

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: N/A

Type: Task Priority: Minor
Reporter: Federico Razzoli Assignee: Sergei Golubchik
Resolution: Won't Fix Votes: 0
Labels: create_table


 Description   

There are cases when I want to use CREATE OR REPLACE TABLE, but also want the statement to work on pre-10.0 versions with an IF NOT EXISTS clause. But OR REPLACE and IF NOT EXISTS can't be both specified, because an error occurs.

So, I have a feature request. Pre-10.0 versions could treat OR REPLACE like IF NOT EXISTS. I understand that the behaviour would be internally different, but it would be ok in most cases I can think.



 Comments   
Comment by Sergei Golubchik [ 2015-03-05 ]

I think it would be a pretty weird behavior. Because, precisely, the semantics is different.
It's like replacing UPDATE with DELETE+INSERT.

But if we implement MDEV-7381, then you could achieve the same effect with

CREATE /*!1000 OR REPLACE */ TABLE /*!<1000 IF NOT EXISTS */ t1 ...

(I don't know what syntax will be implemented in MDEV-7381, so I've arbitrarily used /*!<####)

Generated at Thu Feb 08 07:14:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.