BUG #1862: ECPG Connect, host variable trailing blanks - Mailing list pgsql-bugs

From James Gray
Subject BUG #1862: ECPG Connect, host variable trailing blanks
Date
Msg-id 20050906200247.DF149F1159@svr2.postgresql.org
Whole thread Raw
Responses Re: BUG #1862: ECPG Connect, host variable trailing blanks
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1862
Logged by:          James Gray
Email address:      jim.gray@bull.com
PostgreSQL version: 8.0.3
Operating system:   Red Hat Enterprise Linux AS release 4 (Nahant Update 1),
Kernel 2.6.9-11.EL on an ia64
Description:        ECPG Connect, host variable trailing blanks
Details:

We are processing a COBOL/SQL program, and feeding the results to ECPG as
C/SQL
(since Postgres does not yet have a Cobol/Sql preprocessor).

The problem that we are having involves a connect statement with host
variables:
   EXEC SQL  CONNECT TO  :target  AS  :user

Our problem is that we are passed Cobol strings which are blank padded.
Our string strategy works fine for Oracle, but not for Postgres CONNECTs.

For example, if we are trying to connect to:
 - database:  demo
 - user:      scott
 - password:  tiger
the strings must be "demo", "scott" and "tiger".

With trailing blanks user "scott" will not match user "scott     ",
which is what we will present if the user had defined the Cobol variable as
PIC X(10).

There does not seem to be an option for Postgres to ignore trailing blanks
in the CONNECT host variables.

This only applies to CONNECT host variables, since trailing blanks in a
CHAR column are ignored in comparisons for all other interactions with
Postgres.

Since this is inconsistent behavior, and also doesn't match Oracle's
behavior,
we are requesting a fix or an option.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: extra columns in intermediate nodes not being removed by top level of executor
Next
From: "Kevin Grittner"
Date:
Subject: Re: Serialization errors on single threaded request