public inbox for [email protected]  
help / color / mirror / Atom feed
PL/PgSQL INTO (used to be BUG #8870)
4+ messages / 2 participants
[nested] [flat]

* PL/PgSQL INTO (used to be BUG #8870)
@ 2014-07-31 21:34 Marko Tiikkaja <[email protected]>
  2014-08-01 11:33 ` Re: PL/PgSQL INTO (used to be BUG #8870) Marti Raudsepp <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Marko Tiikkaja @ 2014-07-31 21:34 UTC (permalink / raw)
  To: pgsql-docs

Hi,

As discussed in #8870, the docs make unfounded claims on INTO.  Here's a 
patch removing the incorrect part.



.marko

*** a/doc/src/sgml/plpgsql.sgml
--- b/doc/src/sgml/plpgsql.sgml
***************
*** 1023,1032 **** DELETE ... RETURNING <replaceable>expressions</replaceable> INTO <optional>STRIC
     </tip>
  
      <para>
!      If a row or a variable list is used as target, the query's result columns
!      must exactly match the structure of the target as to number and data
!      types, or else a run-time error
!      occurs.  When a record variable is the target, it automatically
       configures itself to the row type of the query result columns.
      </para>
  
--- 1023,1029 ----
     </tip>
  
      <para>
!      When a record variable is the target, it automatically
       configures itself to the row type of the query result columns.
      </para>
  


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Attachments:

  [text/plain] plpgsql_bull.patch (758B, 2-plpgsql_bull.patch)
  download | inline diff:
*** a/doc/src/sgml/plpgsql.sgml
--- b/doc/src/sgml/plpgsql.sgml
***************
*** 1023,1032 **** DELETE ... RETURNING <replaceable>expressions</replaceable> INTO <optional>STRIC
     </tip>
  
      <para>
!      If a row or a variable list is used as target, the query's result columns
!      must exactly match the structure of the target as to number and data
!      types, or else a run-time error
!      occurs.  When a record variable is the target, it automatically
       configures itself to the row type of the query result columns.
      </para>
  
--- 1023,1029 ----
     </tip>
  
      <para>
!      When a record variable is the target, it automatically
       configures itself to the row type of the query result columns.
      </para>
  


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PL/PgSQL INTO (used to be BUG #8870)
  2014-07-31 21:34 PL/PgSQL INTO (used to be BUG #8870) Marko Tiikkaja <[email protected]>
@ 2014-08-01 11:33 ` Marti Raudsepp <[email protected]>
  2014-08-01 11:43   ` Re: PL/PgSQL INTO (used to be BUG #8870) Marko Tiikkaja <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Marti Raudsepp @ 2014-08-01 11:33 UTC (permalink / raw)
  To: Marko Tiikkaja <[email protected]>; +Cc: pgsql-docs

On Fri, Aug 1, 2014 at 12:34 AM, Marko Tiikkaja <[email protected]> wrote:
> Here's a patch removing the incorrect part.

I can see how this doc statement can be misunderstood, but I think the
claims are actually about data types, not the number of columns in the
INTO list.

I think clarifying the number of columns quirk would be better than
removing this text.

Regards,
Marti


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PL/PgSQL INTO (used to be BUG #8870)
  2014-07-31 21:34 PL/PgSQL INTO (used to be BUG #8870) Marko Tiikkaja <[email protected]>
  2014-08-01 11:33 ` Re: PL/PgSQL INTO (used to be BUG #8870) Marti Raudsepp <[email protected]>
@ 2014-08-01 11:43   ` Marko Tiikkaja <[email protected]>
  2014-08-01 12:57     ` Re: PL/PgSQL INTO (used to be BUG #8870) Marti Raudsepp <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Marko Tiikkaja @ 2014-08-01 11:43 UTC (permalink / raw)
  To: Marti Raudsepp <[email protected]>; +Cc: pgsql-docs

On 8/1/14 1:33 PM, Marti Raudsepp wrote:
> On Fri, Aug 1, 2014 at 12:34 AM, Marko Tiikkaja <[email protected]> wrote:
>> Here's a patch removing the incorrect part.
>
> I can see how this doc statement can be misunderstood, but I think the
> claims are actually about data types, not the number of columns in the
> INTO list.

I don't really speak English, but I can't see what else the "as to 
number" part could mean.

But the claim about "exactly matching" data types is completely bogus, too:

   local:marko=#* do $$ declare _f1 timestamp;
   local:marko$#* begin select current_date into _f1;
   local:marko$#* end $$ ;
   DO

   local:marko=# do $$ declare _f1 timestamp;
   local:marko$# begin select text '2004-01-01' into _f1;
   local:marko$# end $$ ;
   DO


.marko


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PL/PgSQL INTO (used to be BUG #8870)
  2014-07-31 21:34 PL/PgSQL INTO (used to be BUG #8870) Marko Tiikkaja <[email protected]>
  2014-08-01 11:33 ` Re: PL/PgSQL INTO (used to be BUG #8870) Marti Raudsepp <[email protected]>
  2014-08-01 11:43   ` Re: PL/PgSQL INTO (used to be BUG #8870) Marko Tiikkaja <[email protected]>
@ 2014-08-01 12:57     ` Marti Raudsepp <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Marti Raudsepp @ 2014-08-01 12:57 UTC (permalink / raw)
  To: Marko Tiikkaja <[email protected]>; +Cc: pgsql-docs

On Fri, Aug 1, 2014 at 2:43 PM, Marko Tiikkaja <[email protected]> wrote:
> But the claim about "exactly matching" data types is completely bogus, too

My bad. I remember having a hard time with matching data types in
PL/pgSQL in one instance, but turns out that was with RETURN QUERY,
not INTO.

Anyway, I'd prefer adding an explicit warning about the non-strict
behavior. How about:

"The number of columns returned by the query is not checked to match
target variables. Superfluous target variables are assigned the value
NULL.
When a record variable is the target, it automatically
configures itself to the row type of the query result columns."

Regards,
Marti


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2014-08-01 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-07-31 21:34 PL/PgSQL INTO (used to be BUG #8870) Marko Tiikkaja <[email protected]>
2014-08-01 11:33 ` Marti Raudsepp <[email protected]>
2014-08-01 11:43   ` Marko Tiikkaja <[email protected]>
2014-08-01 12:57     ` Marti Raudsepp <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox