Re: [PATCHES] minor cleanup in plpgsql.sgml

2003-11-29 Thread Bruce Momjian
Tom Lane wrote:
 Robert Treat [EMAIL PROTECTED] writes:
  Funny. That's a good argument for doing it that way, but almost the same
  argument I make for putting the INTO at the end: so as to not confuse
  people with the SELECT a,b,c INTO newtable FROM oldtable sql syntax.
  In either case ISTM the existing recommendation is flawed. 
 
 Come to think of it, I think that the motivation for the existing
 recommendation was precisely to have a syntax that is visibly different
 from the SQL-level SELECT INTO, with an eye to eventually allowing the
 SQL construct to work too.  This may not be very important though,
 considering that SELECT INTO is deprecated in favor of CREATE TABLE AS.

I have removed the recommentation:

para
 The literalINTO/ clause can appear almost anywhere in the 
commandSELECT/command
 statement.
/para


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [PATCHES] minor cleanup in plpgsql.sgml

2003-11-25 Thread Peter Eisentraut
Tom Lane writes:

 Robert Treat [EMAIL PROTECTED] writes:
  ! SELECT INTO users_rec * FROM users WHERE user_id=3;
  --- 986,993 
  ! SELECT * FROM users WHERE user_id=3 INTO users_rec;

 Why do you want to change the example to disagree with the advice given
 just above?

 : At present, the INTO clause can appear almost anywhere in the SELECT
 : statement, but it is recommended to place it immediately after the
 : SELECT key word as depicted above. Future versions of PL/pgSQL may be
 : less forgiving about placement of the INTO clause.

Well, that position is a strange choice.  The standard syntax of SELECT
INTO in embedded SQL is

SELECT a, b, c INTO :x, :y, :z FROM ...

This should probably be consistent.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [PATCHES] minor cleanup in plpgsql.sgml

2003-11-25 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes:
 Well, that position is a strange choice.  The standard syntax of SELECT
 INTO in embedded SQL is
 SELECT a, b, c INTO :x, :y, :z FROM ...
 This should probably be consistent.

Well, I'm not wedded to the current recommendation, but we'll never be
able to clean up the current weird-hack implementation of SELECT INTO
until we can freeze the syntax somehow.  The above looks at least as
reasonable as what we're currently recommending ...

regards, tom lane

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [PATCHES] minor cleanup in plpgsql.sgml

2003-11-25 Thread Robert Treat
Sorry Neil. I thought I recalled you submitting a similar patch, but
must have missed it in the archives and didn't see the change reflected
in cvs so assmeme'd that your change was in a different place.. :-(

Robert Treat

On Tue, 2003-11-25 at 14:04, Neil Conway wrote:
 Robert Treat [EMAIL PROTECTED] writes:
  Marcos Truchado [EMAIL PROTECTED] reported this on -docs
  yesterday.
 
 I submitted a patch for this typo to -patches 5 days ago.
 
 -Neil
 
 
 ---(end of broadcast)---
 TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [PATCHES] minor cleanup in plpgsql.sgml

2003-11-25 Thread Christopher Kings-Lynne
Ummm - surely the original was correct?

Chris

Robert Treat wrote:

Marcos Truchado [EMAIL PROTECTED] reported this on -docs yesterday.

Robert Treat



Index: plpgsql.sgml
===
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/plpgsql.sgml,v
retrieving revision 1.29
diff -c -r1.29 plpgsql.sgml
*** plpgsql.sgml	12 Nov 2003 22:47:47 -	1.29
--- plpgsql.sgml	25 Nov 2003 14:12:50 -
***
*** 986,994 
  programlisting
  DECLARE
  users_rec RECORD;
- full_name varchar;
  BEGIN
! SELECT INTO users_rec * FROM users WHERE user_id=3;
  
  IF users_rec.homepage IS NULL THEN
  -- user entered no homepage, return http://;
--- 986,993 
  programlisting
  DECLARE
  users_rec RECORD;
  BEGIN
! SELECT * FROM users WHERE user_id=3 INTO users_rec;
  
  IF users_rec.homepage IS NULL THEN
  -- user entered no homepage, return http://;



---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [PATCHES] minor cleanup in plpgsql.sgml

2003-11-25 Thread Robert Treat
The reported correction was removing the superfluous full_name varchar (which 
Neil Conway also reported a few days back).   When i was rewriting the 
function, I subconsciously switched the SELECT INTO statement to the (IMHO) 
more legible syntax, though nothing was wrong with the previous version of 
that statement. 

Robert Treat

On Tuesday 25 November 2003 20:30, Christopher Kings-Lynne wrote:
 Ummm - surely the original was correct?

 Chris

 Robert Treat wrote:
  Marcos Truchado [EMAIL PROTECTED] reported this on -docs
  yesterday.
 
  Robert Treat
 
 
  
 
  Index: plpgsql.sgml
  ===
  RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/plpgsql.sgml,v
  retrieving revision 1.29
  diff -c -r1.29 plpgsql.sgml
  *** plpgsql.sgml12 Nov 2003 22:47:47 -  1.29
  --- plpgsql.sgml25 Nov 2003 14:12:50 -
  ***
  *** 986,994 
programlisting
DECLARE
users_rec RECORD;
  - full_name varchar;
BEGIN
  ! SELECT INTO users_rec * FROM users WHERE user_id=3;
 
IF users_rec.homepage IS NULL THEN
-- user entered no homepage, return http://;
  --- 986,993 
programlisting
DECLARE
users_rec RECORD;
BEGIN
  ! SELECT * FROM users WHERE user_id=3 INTO users_rec;
 
IF users_rec.homepage IS NULL THEN
-- user entered no homepage, return http://;
 
 
  
 
 
  ---(end of broadcast)---
  TIP 4: Don't 'kill -9' the postmaster

 ---(end of broadcast)---
 TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html