Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oALYE-0003xI-Df for pgsql-docs@arkaria.postgresql.org; Sun, 10 Jul 2022 01:15:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oALYC-0005XQ-PL for pgsql-docs@arkaria.postgresql.org; Sun, 10 Jul 2022 01:15:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oALYC-0005XH-IB for pgsql-docs@lists.postgresql.org; Sun, 10 Jul 2022 01:15:56 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oALYA-00051i-3U; Sun, 10 Jul 2022 01:15:56 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1oALY8-0019QJ-13; Sat, 09 Jul 2022 21:15:52 -0400 Date: Sat, 9 Jul 2022 21:15:52 -0400 From: Bruce Momjian To: "ideriha.takeshi@fujitsu.com" Cc: "'pgsql-docs@lists.postgresql.org'" , "'meskes@postgresql.org'" Subject: Re: No documentation exists about ecpg ORACLE comptaible mode Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="j73SH0UYpF5XXrPc" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --j73SH0UYpF5XXrPc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 7, 2022 at 08:28:55AM +0000, ideriha.takeshi@fujitsu.com wrote: > Hi. > (CCing Michael Meskes) > > One of my customers asked me about what oracle compatibility mode in ecpg means, > and I noticed current documentation does not explain ecpg ORACLE compatible mode (ecpg -C ORACLE) in detail. > I myself learned the feature of "-C ORACLE" from regression test (src/interfaces/ecpg/test/compat_oracle) and source code. > > Is lacking documentation intentional or do commit 3b7ab4380 and 3b9b7516f just forget adding the explanation? > > As for as I know, "ecpg -C ORACLE" is written briefly in ecpg command reference and PostgreSQL 11 release note, > but they are not enougn information for users to understand feature of "ecpg -C ORACLE". > > https://www.postgresql.org/docs/current/app-ecpg.html > > ------------------------------- > -C mode > Set a compatibility mode. mode can be INFORMIX, INFORMIX_SE, or ORACLE. > ------------------------------- > > https://www.postgresql.org/docs/11/release-11.html#id-1.11.6.21.5.9 > ------------------------------- > Add an ecpg mode to enable Oracle Pro*C-style handling of char arrays. > > This mode is enabled with -C. > ------------------------------- > > On the other hand, informix compatible mode is written in detail. > https://www.postgresql.org/docs/current/ecpg-informix-compat.html This is a very good point. I have studied the issue and created the attached patch to document Oracle-compatibility mode. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson --j73SH0UYpF5XXrPc Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ecpg.diff" diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml index 7f8b4dd5c0..999b7ca0ae 100644 --- a/doc/src/sgml/ecpg.sgml +++ b/doc/src/sgml/ecpg.sgml @@ -1890,7 +1890,8 @@ EXEC SQL SELECT b INTO :val :val_ind FROM test1; The indicator variable val_ind will be zero if the value was not null, and it will be negative if the value was - null. + null. (See to enable + Oracle-specific behavior.) @@ -9799,6 +9800,42 @@ risnull(CINTTYPE, (char *) &i); + + <productname>Oracle</productname> Compatibility Mode + + ecpg can be run in a so-called Oracle + compatibility mode. If this mode is active, it tries to + behave as if it were Oracle Pro*C. + + + + Specifically, this mode changes ecpg in three ways: + + + + + Pad character arrays receiving character string types with + trailing spaces to the specified length + + + + + + Zero byte terminate these character arrays, and set the indicator + variable if truncation occurs + + + + + + Set the null indicator to -1 when character + arrays receive empty character string types + + + + + + Internals --j73SH0UYpF5XXrPc--