Re: [GENERAL] CREATE TABLE AS does not support IF NOT EXISTS?

2012-02-12 Thread David Waddy
Thank-you, mystery solved! I was reading the "CREATE TABLE" docs and not the "CREATE TABLE AS" docs. My mistake. David Waddy On Sun, Feb 12, 2012 at 3:50 PM, Adrian Klaver wrote: > On Sunday, February 12, 2012 11:42:37 am David Waddy wrote: > > This works: > > CREATE TEMP TABLE temp_medical_sum

Re: [GENERAL] CREATE TABLE AS does not support IF NOT EXISTS?

2012-02-12 Thread Adrian Klaver
On Sunday, February 12, 2012 11:42:37 am David Waddy wrote: > This works: > CREATE TEMP TABLE temp_medical_summary AS (SELECT * from > bov.medical_summary) > > This gives an error: > CREATE TEMP TABLE IF NOT EXISTS temp_medical_summary AS (SELECT * from > bov.medical_summary) > > It would seem th

[GENERAL] CREATE TABLE AS does not support IF NOT EXISTS?

2012-02-12 Thread David Waddy
This works: CREATE TEMP TABLE temp_medical_summary AS (SELECT * from bov.medical_summary) This gives an error: CREATE TEMP TABLE IF NOT EXISTS temp_medical_summary AS (SELECT * from bov.medical_summary) It would seem that CREATE TABLE AS does not support IF NOT EXISTS. Is this true? David Waddy

Re: [GENERAL] create table as select... with auto increment id ?

2011-07-25 Thread Joe Conway
On 07/25/2011 05:17 PM, David Salisbury wrote: > > We all know i can > > create table freaky as select "abunchofstuff". > > I work with rails developers and they are fussy about having an > auto incrementing "id" field. Is there a way I can eak that out > of the above type statement, or am I st

Re: [GENERAL] create table as select... with auto increment id ?

2011-07-25 Thread Peter Geoghegan
On 26 July 2011 01:17, David Salisbury wrote: > I work with rails developers and they are fussy about having an > auto incrementing "id" field.  Is there a way I can eak that out > of the above type statement, or am I stuck with creating the > table and no short cuts? > > create table freaky ( id

[GENERAL] create table as select... with auto increment id ?

2011-07-25 Thread David Salisbury
We all know i can create table freaky as select "abunchofstuff". I work with rails developers and they are fussy about having an auto incrementing "id" field. Is there a way I can eak that out of the above type statement, or am I stuck with creating the table and no short cuts? create table f

Re: [GENERAL] create table as select VS create table; insert as select

2010-10-29 Thread Tom Lane
Jacqui Caren-home writes: > I have inherited an application that populates a number of > temp.y tables using create table ... as select ... > As this process hammers the database, I can only run benchmarks at night so > am asking here if anyone know if > create table ...; then insert into ... as s

Re: [GENERAL] create table as select VS create table; insert as select

2010-10-29 Thread Sergey Konoplev
Hi, On 29 October 2010 11:46, Jacqui Caren-home wrote: > I have inherited an application that populates a number of > temp.y tables using create table ... as select ... What is the principle of creating this temp.y tables? May be table partitioning is better to implement here - http://www.postgr

[GENERAL] create table as select VS create table; insert as select

2010-10-29 Thread Jacqui Caren-home
I have inherited an application that populates a number of temp.y tables using create table ... as select ... This is taking roughly five to ten minutes to run As this process hammers the database, I can only run benchmarks at night so am asking here if anyone know if create table ...; then ins

Re: [GENERAL] create table as vs. create table like

2008-12-12 Thread Ivan Sergio Borgonovo
On Fri, 12 Dec 2008 13:25:07 +0100 "A. Kretschmer" wrote: > In response to Ivan Sergio Borgonovo : > > I just noticed something I found "unexpected". > > > > CREATE TABLE LIKE let you specify DEFAULT and Co. > > CREATE TABLE AS doesn't. > > > > Is there a one step way to clone a table? > > wit

Re: [GENERAL] create table as vs. create table like

2008-12-12 Thread Gregory Williamson
Andreas K. wrote: > > In response to Ivan Sergio Borgonovo : > > I just noticed something I found "unexpected". > > > > CREATE TABLE LIKE let you specify DEFAULT and Co. > > CREATE TABLE AS doesn't. > > > > Is there a one step way to clone a table? > > with or without data? > > create table ne

Re: [GENERAL] create table as vs. create table like

2008-12-12 Thread A. Kretschmer
In response to Ivan Sergio Borgonovo : > I just noticed something I found "unexpected". > > CREATE TABLE LIKE let you specify DEFAULT and Co. > CREATE TABLE AS doesn't. > > Is there a one step way to clone a table? with or without data? create table new_table (like old_table) create table new_t

[GENERAL] create table as vs. create table like

2008-12-12 Thread Ivan Sergio Borgonovo
I just noticed something I found "unexpected". CREATE TABLE LIKE let you specify DEFAULT and Co. CREATE TABLE AS doesn't. Is there a one step way to clone a table? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To mak

Re: [GENERAL] create table as problem

2006-09-15 Thread Michael Fuhr
On Fri, Sep 15, 2006 at 09:42:35PM +0100, garry saddington wrote: > I am getting a syntax error at or near 'as' in this method, can anyone > help? > > create table iclasses > (classid serial, > subject text, > year text, > groups text, > teacher text, > set text > ) > as select distinct subject,y

[GENERAL] create table as problem

2006-09-15 Thread garry saddington
I am getting a syntax error at or near 'as' in this method, can anyone help? create table iclasses (classid serial, subject text, year text, groups text, teacher text, set text ) as select distinct subject,year,groups,teacher,set from interimclasses I need to make a new table with a classid. Any

Re: [GENERAL] CREATE TABLE AS COMMAND

2003-12-05 Thread Greg Stark
> On Fri, Dec 05, 2003 at 13:20:27 -0500, > Bob Powell <[EMAIL PROTECTED]> wrote: > > > SELECT * FROM addresses LEFT OUTER JOIN contacts ON > > contacts.participant_id = addresses.participant_id; > > > > Running the select obviously works fine, it's just when I try to create a > > table when I

Re: [GENERAL] CREATE TABLE AS COMMAND

2003-12-05 Thread Bruno Wolff III
On Fri, Dec 05, 2003 at 13:20:27 -0500, Bob Powell <[EMAIL PROTECTED]> wrote: > To whom it may concern, > > The following select works fine until I use the CREATE TEMP TABLE AS command because > of the matching participant_id's in each table. > > SELECT * FROM addresses LEFT OUTER JOIN contac

[GENERAL] CREATE TABLE AS COMMAND

2003-12-05 Thread Bob Powell
To whom it may concern, The following select works fine until I use the CREATE TEMP TABLE AS command because of the matching participant_id's in each table. SELECT * FROM addresses LEFT OUTER JOIN contacts ON contacts.participant_id = addresses.participant_id; Running the select obviously work

RE: [GENERAL] CREATE TABLE AS... syntax?

2001-04-26 Thread Tamsin
i think its: CREATE TABLE foo AS SELECT number FROM account; tamsin > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Dr. Evil > Sent: 25 April 2001 23:46 > To: [EMAIL PROTECTED] > Subject: [GENERAL] CREATE TABLE AS... syntax? >

Re: [GENERAL] CREATE TABLE AS... syntax?

2001-04-25 Thread Len Morgan
>CREATE TABLE foo (test INT4) AS SELECT number FROM account; I think you want something like: SELECT number INTO TABLE foo FROM account ; len morgan ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

[GENERAL] CREATE TABLE AS... syntax?

2001-04-25 Thread Dr. Evil
I'm trying to use CREATE TABLE AS under 7.03. There are no examples in the guide, so I tried a few things: CREATE TABLE foo (test INT4) AS SELECT number FROM account; and CREATE TABLE foo (test INT4) AS number FROM account; and both of them give ERROR: parser: parse error at or near "as".

Re: [GENERAL] CREATE TABLE AS

2000-01-24 Thread Bruce Momjian
> Hi, > > How do I create a table from a 'select' statement? > I tried the help from psql '\h create table', > it does not explain how. > > I tried: > > create table blah2 as > select pin from tbs_billing_record > where date(start_time) between '01-JAN-2000' and '23-JAN-2000' > order by pin; S

Re: [GENERAL] CREATE TABLE AS

2000-01-24 Thread David Warnock
Chai, Just miss out the order by, it has no meaning in a table definition. ie Create table blah2 as select pin from tbs_billing_record where date(start_time) between '01-JAN-2000' and '23-JAN-2000'; Dave

[GENERAL] CREATE TABLE AS

2000-01-24 Thread Chairudin Sentosa Harjo
Hi, How do I create a table from a 'select' statement? I tried the help from psql '\h create table', it does not explain how. I tried: create table blah2 as select pin from tbs_billing_record where date(start_time) between '01-JAN-2000' and '23-JAN-2000' order by pin; I received error saying: