Re: [HACKERS] 'Create table if not exists as' breaks SPI_execute

2016-04-11 Thread Tom Lane
Stas Kelvich writes: > SPI_execute assumes that CreateTableAsStmt always have completionTag == > “completionTag”. > But it isn’t true in case of ‘IF NOT EXISTS’ present. Pushed, thanks. regards, tom lane -- Sent via pgsql-hackers

Re: [HACKERS] 'Create table if not exists as' breaks SPI_execute

2016-04-11 Thread Stas Kelvich
> On 11 Apr 2016, at 18:41, Stas Kelvich wrote: > > Hi. > > SPI_execute assumes that CreateTableAsStmt always have completionTag == > “completionTag”. > But it isn’t true in case of ‘IF NOT EXISTS’ present. > > > Sorry, I meant completionTag == “SELECT”. -- Stas

[HACKERS] 'Create table if not exists as' breaks SPI_execute

2016-04-11 Thread Stas Kelvich
Hi. SPI_execute assumes that CreateTableAsStmt always have completionTag == “completionTag”. But it isn’t true in case of ‘IF NOT EXISTS’ present. spi-cta.patch Description: Binary data -- Stas Kelvich Postgres Professional: http://www.postgrespro.com Russian Postgres Company -- Sent

Re: [HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-20 Thread Craig Ringer
On 11/20/2013 03:41 PM, Pavel Stehule wrote: It'd be great if there was a sane way to implement CREATE OR REPLACE TABLE - since that's what people really want a lot of the time. Ensure that at the end of this command the table looks like this. There's just no sane way to do

Re: [HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-19 Thread Peter Eisentraut
On Mon, 2013-11-18 at 11:16 -0200, Fabrízio de Royes Mello wrote: I'm planning to implement it for the next commit fest (2014-01)... This email was registered in the commit fest as a patch, but contains no patch and you indicate that it belongs in different commit fest. Please sort that out.

Re: [HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-19 Thread Fabrízio de Royes Mello
On Wed, Nov 20, 2013 at 2:10 AM, Peter Eisentraut pete...@gmx.net wrote: On Mon, 2013-11-18 at 11:16 -0200, Fabrízio de Royes Mello wrote: I'm planning to implement it for the next commit fest (2014-01)... This email was registered in the commit fest as a patch, but contains no patch and

Re: [HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-19 Thread Craig Ringer
On 11/17/2013 08:40 AM, Tom Lane wrote: That's an even worse idea than plain CREATE IF NOT EXISTS (which was put in over vocal objections from me and some other people). I'm pretty uncomfortable with CREATE TABLE IF NOT EXISTS too - but it doesn't hurt someone who doesn't use it and it does

Re: [HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-19 Thread Pavel Stehule
2013/11/20 Craig Ringer cr...@2ndquadrant.com On 11/17/2013 08:40 AM, Tom Lane wrote: That's an even worse idea than plain CREATE IF NOT EXISTS (which was put in over vocal objections from me and some other people). I'm pretty uncomfortable with CREATE TABLE IF NOT EXISTS too - but it

Re: [HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-18 Thread Fabrízio de Royes Mello
On Sun, Nov 17, 2013 at 6:05 PM, David E. Wheeler da...@justatheory.comwrote: On Nov 16, 2013, at 4:40 PM, Tom Lane t...@sss.pgh.pa.us wrote: Co-worker asked a question I could not answer: Why is IF NOT EXISTS not supported by CREATE TABLE AS? That's an even worse idea than plain CREATE

Re: [HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-17 Thread David E. Wheeler
On Nov 16, 2013, at 4:40 PM, Tom Lane t...@sss.pgh.pa.us wrote: Co-worker asked a question I could not answer: Why is IF NOT EXISTS not supported by CREATE TABLE AS? That's an even worse idea than plain CREATE IF NOT EXISTS (which was put in over vocal objections from me and some other

[HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-16 Thread David E. Wheeler
Hackers, Co-worker asked a question I could not answer: Why is IF NOT EXISTS not supported by CREATE TABLE AS? Oversight, perhaps? Or maybe because one expects the table to have the data from the SELECT statement? If the latter, maybe OR REPLACE would be useful? Best, David -- Sent via

Re: [HACKERS] CREATE TABLE IF NOT EXISTS AS

2013-11-16 Thread Tom Lane
David E. Wheeler da...@justatheory.com writes: Co-worker asked a question I could not answer: Why is IF NOT EXISTS not supported by CREATE TABLE AS? That's an even worse idea than plain CREATE IF NOT EXISTS (which was put in over vocal objections from me and some other people). Not only would