When I replied I was not meaning the aim of this query but the aim of Mr.
Hassan who first asked that question on September 28, 2003.

I just rephrased his question!!!

Below is a text he wrote.
Please note where he said:
        ..... I expected it to simply exit silently when it
                finds that the table *does* already exist.
===================================================
Is there a problem with 'IF NOT EXISTS' in the following scenario?
This statement creates the table as expected ...
CREATE TEMPORARY TABLE IF NOT EXISTS
showcase (
  PRIMARY KEY (product)
  )
SELECT product FROM productList

.. but re-running it (from the console or via page reload) results
in  "ERROR 1062: Duplicate entry 'foo' for key 1"

I expected it to simply exit silently when it finds that the table
*does* already exist. So what am I missing?  :-)
===================================================

Now, do you think I was right in my rephrasing?
To me, I think that is a bug and should be reported to MySQL. When the IF
condition is false, it should break the rest of the statement.
What is your view on this?


Thanks
Emery
----- Original Message -----
From: "Antony Dovgal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 29, 2003 13:28
Subject: Re: 'IF NOT EXISTS' ignored?


> On Mon, 29 Sep 2003 12:30:28 +0200
> "Director General: NEFACOMP" <[EMAIL PROTECTED]> wrote:
>
> > It seems Victoria didn't understand the real problem:
> >
> > I think that query should be stopped as soon as the table exists.
> > But if it doesn't exist, the query should create it and insert some
records.
> > The problem is: WHY is MySQL trying to insert records while the table
> > exists? It should only insert records after creating the table (and
table
> > will be created only when t doesn't exist already).
>
> I don't think you're right.
> The main aim of this query is to INSERT data into table.
> And before this it checks if the table already exists and creates it if
not.
> So, there is no problem imho.
>
> > So, in that query, will the IF condition apply for table creation only?
> Yes.
>
> ---
> WBR,
> Antony Dovgal aka tony2001
> [EMAIL PROTECTED]
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to