The attached patch documents all the ecpg error messages except for the
6XX numbers which don't have descriptions so they may be different from
the others.
> >
> > I have added documentation for code 209. Looks like there are other
> > undocumented ones. Should we document them all?
>
> If you're asking me, I'm all in favour of documenting them;-)
>
> I'm not a fan of "Read the source," though I do it if I'm desperate.
>
>
>
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@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
Index: doc/src/sgml/ecpg.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v
retrieving revision 1.24
diff -c -r1.24 ecpg.sgml
*** doc/src/sgml/ecpg.sgml 2001/10/11 20:25:42 1.24
--- doc/src/sgml/ecpg.sgml 2001/10/18 20:28:54
***************
*** 195,205 ****
</para>
<para>
! If an error occurred in the last <acronym>SQL</acronym> statement.
! <parameter>sqlca.sqlcode</parameter> will be non-zero. If
! <parameter>sqlca.sqlcode</parameter> is less that 0, this is a
serious error, like the database definition does not match the
! query. If it is greater than 0, it is a normal error like the
table did not contain the requested row.
</para>
--- 195,205 ----
</para>
<para>
! If an no error occurred in the last <acronym>SQL</acronym> statement.
! <parameter>sqlca.sqlcode</parameter> will be 0 (ECPG_NO_ERROR). If
! <parameter>sqlca.sqlcode</parameter> is less that zero, this is a
serious error, like the database definition does not match the
! query. If it is greater than zero, it is a normal error like the
table did not contain the requested row.
</para>
***************
*** 210,216 ****
</para>
<para>
! List of errors that can occur:
<variablelist>
<varlistentry>
--- 210,216 ----
</para>
<para>
! These are the errors that can occur:
<variablelist>
<varlistentry>
***************
*** 224,230 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-200, Unsupported type %s on line %d.</computeroutput></term>
<listitem>
<para>
Should not normally occur. This indicates the preprocessor has
--- 224,230 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-200 (ECPG_UNSUPPORTED), Unsupported type %s on line %d.</computeroutput></term>
<listitem>
<para>
Should not normally occur. This indicates the preprocessor has
***************
*** 236,242 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-201, Too many arguments line %d.</computeroutput></term>
<listitem>
<para>
This means that <productname>Postgres</productname> has
--- 236,242 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-201 (ECPG_TOO_MANY_ARGUMENTS), Too many arguments line %d.</computeroutput></term>
<listitem>
<para>
This means that <productname>Postgres</productname> has
***************
*** 248,254 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-202, Too few arguments line %d.</computeroutput></term>
<listitem>
<para>
This means that <productname>Postgres</productname> has
--- 248,254 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-202 (ECPG_TOO_FEW_ARGUMENTS), Too few arguments line %d.</computeroutput></term>
<listitem>
<para>
This means that <productname>Postgres</productname> has
***************
*** 260,266 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-203, Too many matches line %d.</computeroutput></term>
<listitem>
<para>
This means the query has returned several rows but the
--- 260,266 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-203 (ECPG_TOO_MANY_MATCHES), Too many matches line %d.</computeroutput></term>
<listitem>
<para>
This means the query has returned several rows but the
***************
*** 271,277 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-204, Not correctly formatted int type: %s line %d.</computeroutput></term>
<listitem>
<para>
This means the host variable is of type <type>int</type> and
--- 271,277 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-204 (ECPG_INT_FORMAT), Not correctly formatted int type: %s line
%d.</computeroutput></term>
<listitem>
<para>
This means the host variable is of type <type>int</type> and
***************
*** 284,290 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-205, Not correctly formatted unsigned type: %s line %d.</computeroutput></term>
<listitem>
<para>
This means the host variable is of type <type>unsigned
--- 284,290 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-205 (ECPG_UINT_FORMAT), Not correctly formatted unsigned type: %s line
%d.</computeroutput></term>
<listitem>
<para>
This means the host variable is of type <type>unsigned
***************
*** 298,304 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-206, Not correctly formatted floating point type: %s line %d.</computeroutput></term>
<listitem>
<para>
This means the host variable is of type <type>float</type> and
--- 298,304 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-206 (ECPG_FLOAT_FORMAT), Not correctly formatted floating point type: %s line
%d.</computeroutput></term>
<listitem>
<para>
This means the host variable is of type <type>float</type> and
***************
*** 311,317 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-207, Unable to convert %s to bool on line %d.</computeroutput></term>
<listitem>
<para>
This means the host variable is of type <type>bool</type> and
--- 311,317 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-207 (ECPG_CONVERT_BOOL), Unable to convert %s to bool on line
%d.</computeroutput></term>
<listitem>
<para>
This means the host variable is of type <type>bool</type> and
***************
*** 322,328 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-208, Empty query line %d.</computeroutput></term>
<listitem>
<para>
<productname>Postgres</productname> returned <symbol>PGRES_EMPTY_QUERY</symbol>, probably
--- 322,328 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-208 (ECPG_EMPTY), Empty query line %d.</computeroutput></term>
<listitem>
<para>
<productname>Postgres</productname> returned <symbol>PGRES_EMPTY_QUERY</symbol>, probably
***************
*** 332,338 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-209, NULL value without indicator in line %d.</computeroutput></term>
<listitem>
<para>
<productname>Postgres</productname> returned <symbol>ECPG_MISSING_INDICATOR</symbol>
--- 332,338 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-209 (ECPG_MISSING_INDICATOR), NULL value without indicator in line
%d.</computeroutput></term>
<listitem>
<para>
<productname>Postgres</productname> returned <symbol>ECPG_MISSING_INDICATOR</symbol>
***************
*** 342,357 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-220, No such connection %s in line %d.</computeroutput></term>
<listitem>
<para>
The program tried to access a connection that does not exist.
</para>
</listitem>
</varlistentry>
<varlistentry>
! <term><computeroutput>-221, Not connected in line %d.</computeroutput></term>
<listitem>
<para>
The program tried to access a connection that does exist but is
--- 342,379 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-210 (ECPG_NO_ARRAY), Variable is not an array in line %d.</computeroutput></term>
<listitem>
<para>
+ <productname>Postgres</productname> returned <symbol>ECPG_NO_ARRAY</symbol>
+ because an ordinary variable was used in a place that requires
+ an array.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><computeroutput>-211 (ECPG_DATA_NOT_ARRAY), Data read from backend is not an array in line
%d.</computeroutput></term>
+ <listitem>
+ <para>
+ <productname>Postgres</productname> returned <symbol>ECPG_DATA_NOT_ARRAY</symbol>
+ because the database returned an ordinary variable in a place
+ that requires array value.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><computeroutput>-220 (ECPG_NO_CONN), No such connection %s in line %d.</computeroutput></term>
+ <listitem>
+ <para>
The program tried to access a connection that does not exist.
</para>
</listitem>
</varlistentry>
<varlistentry>
! <term><computeroutput>-221 (ECPG_NOT_CONN), Not connected in line %d.</computeroutput></term>
<listitem>
<para>
The program tried to access a connection that does exist but is
***************
*** 361,367 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-230, Invalid statement name %s in line %d.</computeroutput></term>
<listitem>
<para>
The statement you are trying to use has not been prepared.
--- 383,389 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-230 (ECPG_INVALID_STMT), Invalid statement name %s in line %d.</computeroutput></term>
<listitem>
<para>
The statement you are trying to use has not been prepared.
***************
*** 369,376 ****
</listitem>
</varlistentry>
<varlistentry>
! <term><computeroutput>-400, Postgres error: %s line %d.</computeroutput></term>
<listitem>
<para>
Some <productname>Postgres</productname> error.
--- 391,445 ----
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><computeroutput>-240 (ECPG_UNKNOWN_DESCRIPTOR), Descriptor %s not found in line
%d.</computeroutput></term>
+ <listitem>
+ <para>
+ The descriptor specified was not foundstatement you are trying to use has not been prepared.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><computeroutput>-241 (ECPG_INVALID_DESCRIPTOR_INDEX), Descriptor index out of range in line
%d.</computeroutput></term>
+ <listitem>
+ <para>
+ The descriptor index specified was out of range.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><computeroutput>-242 (ECPG_UNKNOWN_DESCRIPTOR_ITEM), Descriptor %s not found in line
%d.</computeroutput></term>
+ <listitem>
+ <para>
+ The descriptor specified was not foundstatement you are trying to use has not been prepared.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><computeroutput>-243 (ECPG_VAR_NOT_NUMERIC), Variable is not a numeric type in line
%d.</computeroutput></term>
+ <listitem>
+ <para>
+ The database returned a numeric value and the variable was not
+ numeric.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><computeroutput>-244 (ECPG_VAR_NOT_CHAR), Variable is not a character type in line
%d.</computeroutput></term>
+ <listitem>
+ <para>
+ The database returned a non-numeric value and the variable was
+ numeric.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
! <term><computeroutput>-400 (ECPG_PGSQL), Postgres error: %s line %d.</computeroutput></term>
<listitem>
<para>
Some <productname>Postgres</productname> error.
***************
*** 381,387 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-401, Error in transaction processing line %d.</computeroutput></term>
<listitem>
<para>
<productname>Postgres</productname> signaled that we cannot start,
--- 450,456 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-401 (ECPG_TRANS), Error in transaction processing line %d.</computeroutput></term>
<listitem>
<para>
<productname>Postgres</productname> signaled that we cannot start,
***************
*** 391,397 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>-402, connect: could not open database %s.</computeroutput></term>
<listitem>
<para>
The connect to the database did not work.
--- 460,466 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>-402 (ECPG_CONNECT), Could not connect to database %s in line
%d.</computeroutput></term>
<listitem>
<para>
The connect to the database did not work.
***************
*** 400,406 ****
</varlistentry>
<varlistentry>
! <term><computeroutput>100, Data not found line %d.</computeroutput></term>
<listitem>
<para>
This is a <quote>normal</quote> error that tells you that what you are querying cannot
--- 469,475 ----
</varlistentry>
<varlistentry>
! <term><computeroutput>100 (ECPG_NOT_FOUND), Data not found line %d.</computeroutput></term>
<listitem>
<para>
This is a <quote>normal</quote> error that tells you that what you are querying cannot
Index: src/interfaces/ecpg/lib/error.c
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/ecpg/lib/error.c,v
retrieving revision 1.11
diff -c -r1.11 error.c
*** src/interfaces/ecpg/lib/error.c 2001/10/05 17:37:07 1.11
--- src/interfaces/ecpg/lib/error.c 2001/10/18 20:28:59
***************
*** 74,85 ****
case ECPG_NO_ARRAY:
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
! "variable is not an array in line %d.", line);
break;
case ECPG_DATA_NOT_ARRAY:
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
! "data read from backend is not an array in line %d.", line);
break;
case ECPG_NO_CONN:
--- 74,85 ----
case ECPG_NO_ARRAY:
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
! "Variable is not an array in line %d.", line);
break;
case ECPG_DATA_NOT_ARRAY:
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
! "Data read from backend is not an array in line %d.", line);
break;
case ECPG_NO_CONN:
***************
*** 99,110 ****
case ECPG_UNKNOWN_DESCRIPTOR:
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
! "Sescriptor %s not found in line %d.", str, line);
break;
case ECPG_INVALID_DESCRIPTOR_INDEX:
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
! "Sescriptor index out of range in line %d.", line);
break;
case ECPG_UNKNOWN_DESCRIPTOR_ITEM:
--- 99,110 ----
case ECPG_UNKNOWN_DESCRIPTOR:
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
! "Descriptor %s not found in line %d.", str, line);
break;
case ECPG_INVALID_DESCRIPTOR_INDEX:
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
! "Descriptor index out of range in line %d.", line);
break;
case ECPG_UNKNOWN_DESCRIPTOR_ITEM: