[9.3 doc fix] ECPG VAR command does not describe the actual specification

Started by MauMauover 12 years ago2 messages
#1MauMau
maumau307@gmail.com
1 attachment(s)

Hello,

Looking around the 9.3 doc, I found a small, but not-insignificant error in
the documentation.

http://www.postgresql.org/docs/9.3/static/ecpg-sql-var.html

According to the description,

EXEC SQL VAR a IS int;

is equivalent to:

Exec sql begin declare section;
int a;
exec sql end declare section;

However, "ecpg var.pgc" produces the error:

var.pgc:1: ERROR: variable "a" is not declared

On the other hand, the following code can be preprocessed correctly,
treating the host variable "a" as an int type.

--------------------------------------------------
Exec sql begin declare section;
short a;
exec sql end declare section;
EXEC SQL VAR a IS int;

EXEC SQL SELECT c INTO :a FROM mytable;
--------------------------------------------------

The attached patch fixes this documentation error. This is not specific to
9.3, so it needs to be backported. Could you commit this?

Regards
MauMau

Attachments:

ecpg_var_doc.patchapplication/octet-stream; name=ecpg_var_doc.patchDownload
diff -rpcd orig/doc/src/sgml/ecpg.sgml new/doc/src/sgml/ecpg.sgml
*** orig/doc/src/sgml/ecpg.sgml	2013-05-07 05:57:06.000000000 +0900
--- new/doc/src/sgml/ecpg.sgml	2013-06-27 14:29:03.000000000 +0900
*************** VAR <replaceable>varname</replaceable> I
*** 7691,7699 ****
      <title>Description</title>
  
      <para>
!      The <command>VAR</command> command defines a host variable.  It
!      is equivalent to an ordinary C variable definition inside a
!      declare section.
      </para>
     </refsect1>
  
--- 7691,7699 ----
      <title>Description</title>
  
      <para>
!      The <command>VAR</command> command assigns a new C data type
!      to a host variable.  The host variable must be previously
!      declared in a declare section.
      </para>
     </refsect1>
  
*************** VAR <replaceable>varname</replaceable> I
*** 7725,7732 ****
      <title>Examples</title>
  
  <programlisting>
! EXEC SQL VAR vc IS VARCHAR[10];
! EXEC SQL VAR boolvar IS bool;
  </programlisting>
     </refsect1>
  
--- 7725,7734 ----
      <title>Examples</title>
  
  <programlisting>
! Exec sql begin declare section;
! short a;
! exec sql end declare section;
! EXEC SQL VAR a IS int;
  </programlisting>
     </refsect1>
  
#2Michael Meskes
meskes@postgresql.org
In reply to: MauMau (#1)
Re: [9.3 doc fix] ECPG VAR command does not describe the actual specification

Looking around the 9.3 doc, I found a small, but not-insignificant
error in the documentation.

Thanks for finding and fixing. Patch committed.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers