Re: [HACKERS] INSERT INTO

Started by J.M.over 26 years ago8 messages
#1J.M.
darcy@druid.net

Thus spake Thomas Lockhart

I think the docs for SELECT INTO should be changed, as (if memory
serves) it always creates, while INSERT INTO should always require the
table to already exist.

I went back and tested v6.3.2 and found the same behavior. D'Arcy,
would you have time to touch the docs? It would be in

doc/src/sgml/ref/{insert,select}.sgml

Note that there is a separate section for SELECT INTO near the bottom
of select.sgml.

Does this cover it?

RCS file: RCS/select.sgml,v
retrieving revision 1.1
diff -c -r1.1 select.sgml
*** select.sgml 1999/05/08 13:52:15     1.1
--- select.sgml 1999/05/08 13:56:18
***************
*** 85,92 ****
        If the INTO TABLE clause is specified, the result of the
        query will be stored in another table with the indicated
        name.
!       If <replaceable class="PARAMETER">new_table</replaceable> does
!       not exist, it will be created automatically.
        Refer to <command>SELECT INTO</command> for more information.
        <note>
         <para>
--- 85,92 ----
        If the INTO TABLE clause is specified, the result of the
        query will be stored in another table with the indicated
        name.
!       The <replaceable class="PARAMETER">new_table</replaceable> will
!       be created automatically and should not exist before this command.
        Refer to <command>SELECT INTO</command> for more information.
        <note>
         <para>
-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
#2Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: J.M. (#1)

Does this cover it?

Great. Thanks!

- Tom

--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California

#3Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Thomas Lockhart (#2)

Is this done?

The pages at http://postgresql.nextpath.com/docs/user/sql-select.htm and
http://postgresql.nextpath.com/docs/user/sql-insert.htm imply that SELECT
INTO and INSERT INTO <table> SELECT <query> will work with existing
tables but in fact it always creates the table and issues an error if
they already exist. What needs to be fixed here? The code or the docs?

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#4J.M.
darcy@druid.net
In reply to: Bruce Momjian (#3)

Thus spake Bruce Momjian

Is this done?

The pages at http://postgresql.nextpath.com/docs/user/sql-select.htm and
http://postgresql.nextpath.com/docs/user/sql-insert.htm imply that SELECT
INTO and INSERT INTO <table> SELECT <query> will work with existing
tables but in fact it always creates the table and issues an error if
they already exist. What needs to be fixed here? The code or the docs?

I posted the correction. I think Tom Lane is putting it into the docs.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
#5Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: J.M. (#4)

I posted the correction. I think Tom Lane is putting it into the docs.

Actually, the other tgl has some patches :)

- Thomas

--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Thomas Lockhart (#5)

"D'Arcy" "J.M." Cain <darcy@druid.net> writes:

I posted the correction. I think Tom Lane is putting it into the docs.

Not me --- Lockhart.

I know it's confusing having two guys with the initials tgl on the
same project ;-).

regards, tom lane

#7J.M.
darcy@druid.net
In reply to: Tom Lane (#6)

Thus spake Tom Lane

"D'Arcy" "J.M." Cain <darcy@druid.net> writes:

I posted the correction. I think Tom Lane is putting it into the docs.

Not me --- Lockhart.

I know it's confusing having two guys with the initials tgl on the
same project ;-).

Sheesh! We'll just have to get together somewhere all together for a beer
and straighten all this out. :-)

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
#8Bruce Momjian
maillist@candle.pha.pa.us
In reply to: J.M. (#1)

APplied.

Thus spake Thomas Lockhart

I think the docs for SELECT INTO should be changed, as (if memory
serves) it always creates, while INSERT INTO should always require the
table to already exist.

I went back and tested v6.3.2 and found the same behavior. D'Arcy,
would you have time to touch the docs? It would be in

doc/src/sgml/ref/{insert,select}.sgml

Note that there is a separate section for SELECT INTO near the bottom
of select.sgml.

Does this cover it?

RCS file: RCS/select.sgml,v
retrieving revision 1.1
diff -c -r1.1 select.sgml
*** select.sgml 1999/05/08 13:52:15     1.1
--- select.sgml 1999/05/08 13:56:18
***************
*** 85,92 ****
If the INTO TABLE clause is specified, the result of the
query will be stored in another table with the indicated
name.
!       If <replaceable class="PARAMETER">new_table</replaceable> does
!       not exist, it will be created automatically.
Refer to <command>SELECT INTO</command> for more information.
<note>
<para>
--- 85,92 ----
If the INTO TABLE clause is specified, the result of the
query will be stored in another table with the indicated
name.
!       The <replaceable class="PARAMETER">new_table</replaceable> will
!       be created automatically and should not exist before this command.
Refer to <command>SELECT INTO</command> for more information.
<note>
<para>
-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026