Re: BUG #1862: ECPG Connect, host variable trailing blanks

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: BUG #1862: ECPG Connect, host variable trailing blanks
Дата
Msg-id 20050909032840.GA69442@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: BUG #1862: ECPG Connect, host variable trailing blanks  (Jim.Gray@Bull.com)
Ответы Re: BUG #1862: ECPG Connect, host variable trailing blanks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Wed, Sep 07, 2005 at 12:06:10PM -0700, Jim.Gray@Bull.com wrote:
> According to the documentation at:
> http://www.postgresql.org/docs/8.0/static/ecpg-connect.html
>
>    EXEC SQL CONNECT TO :target USER :user;
>    The last form makes use of the variant referred to above as character
>    variable reference.

The complete text is:

  The last form makes use of the variant referred to above as
  character variable reference.  You will see in later sections how
  C variables can be used in SQL statements when you prefix them
  with a colon.

Note "C variables" -- it's talking about the C character type, not
the SQL character type.

> To be consistent with other uses of host variables,
> we request that host variables within a connect statement
> act like host variables in DML statements.

They *do* act the same way: the value is passed to the server, which
handles it according to the appropriate type's semantics.  If the
host variable's value is used in a CHAR context then trailing spaces
aren't significant in comparisons; if the value is used in other
contexts like VARCHAR, TEXT, or NAME, then trailing spaces *are*
significant.  The server makes the decision, not the ECPG preprocessor
or library, which simply passes the value to the server.

If you think this behavior should be changed then propose it on
pgsql-hackers and discuss it with the developers.

--
Michael Fuhr

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ia64-hp-hpux11.23 configure warnings
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1862: ECPG Connect, host variable trailing blanks