Обсуждение: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

Поиск
Список
Период
Сортировка

This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

От
rohtodeveloper
Дата:
Dear all

 

I found a problem in the odbc driver on linux platfrom.

 

Inside the odbc driver,there is a function called check_client_encoding() ,however,there is also a function which has the same name inside the postgres.

once the two functions are in the same process, problems may occur,because the system may choose the wrong function to execute.

If I create a postgres's FUNCTION(myfunc()) using C languageand use this FUNCTION to call the odbc driver(psqlodbcw.so),this problem may happen.

 

The follow picture explain the situation.

The declaration of the two functions are as follows:       

           UCHAR *check_client_encoding(const UCHAR *sql_string);

           bool check_client_encoding(char **newval, void **extra, GucSource source);

 

 

I want to call the odbc's function "check_client_encoding",however it calls the postgres's function "check_client_encoding".

I think this probably is a bug.

 

Call you help me with this problem?

Thank you so much!

 

 

 

Вложения

Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

От
Michael Paquier
Дата:


On Mon, Oct 20, 2014 at 8:56 PM, rohtodeveloper <rohtodeveloper@outlook.com> wrote:

If I create a postgres's FUNCTION(myfunc()) using C languageand use this FUNCTION to call the odbc driver(psqlodbcw.so),this problem may happen.

Why would you want to do that? ODBC driver should run as a client process and should not need to interact in any way with a Postgres server process, aka an internal session of the instance.
--
Michael

Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

От
rohtodeveloper
Дата:

Thanks a lot for your answer.

 

Well ,in fact, if I use the extension called odbc_fdw , the same problem will happen.

That’s because the odbc_fdw will also call the odbc driver.

The follow pictures explain the situation.

 

 

When use the odbc_fdw extension, the libraries are loaded in the following way.


 

After all the libraries are loaded, When the function check_client_encoding is called , the whole postgres process will crash , result in a core dumped problem.

image003.png@01CFF29B.73455510

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                                                                                                                                       Best Regards,
                                                       rohtodeveloper
 

Date: Mon, 20 Oct 2014 21:06:24 +0900
Subject: Re: [ODBC] This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.
From: michael.paquier@gmail.com
To: rohtodeveloper@outlook.com
CC: pgsql-odbc@postgresql.org



On Mon, Oct 20, 2014 at 8:56 PM, rohtodeveloper <rohtodeveloper@outlook.com> wrote:
If I create a postgres's FUNCTION(myfunc()) using C languageand use this FUNCTION to call the odbc driver(psqlodbcw.so),this problem may happen.
Why would you want to do that? ODBC driver should run as a client process and should not need to interact in any way with a Postgres server process, aka an internal session of the instance.
--
Michael

Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

От
rohtodeveloper
Дата:
I'm so sorry, it seems that there was something wrong with the pictures in my last letter.
Here I send the mail again with the correct pictures:
 

Thanks a lot for your answer.

 

Well ,in fact, if I use the extension called odbc_fdw , the same problem will happen.

That’s because the odbc_fdw will also call the odbc driver.

The follow pictures explain the situation.

 

 

When use the odbc_fdw extension, the libraries are loaded in the following way.

 
 

 

After all the libraries are loaded, When the function check_client_encoding is called , the whole postgres process will crash , result in a core dumped problem.

 
 
 
 
Best Regards,
rohtodeveloper
 

From: rohtodeveloper@outlook.com
To: michael.paquier@gmail.com
CC: pgsql-odbc@postgresql.org
Subject: RE: [ODBC] This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.
Date: Tue, 28 Oct 2014 17:35:48 +0000

Thanks a lot for your answer.

 

Well ,in fact, if I use the extension called odbc_fdw , the same problem will happen.

That’s because the odbc_fdw will also call the odbc driver.

The follow pictures explain the situation.

 

 

When use the odbc_fdw extension, the libraries are loaded in the following way.


 

After all the libraries are loaded, When the function check_client_encoding is called , the whole postgres process will crash , result in a core dumped problem.

image003.png@01CFF29B.73455510

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                                                                                                                                       Best Regards,
                                                       rohtodeveloper
 

Date: Mon, 20 Oct 2014 21:06:24 +0900
Subject: Re: [ODBC] This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.
From: michael.paquier@gmail.com
To: rohtodeveloper@outlook.com
CC: pgsql-odbc@postgresql.org



On Mon, Oct 20, 2014 at 8:56 PM, rohtodeveloper <rohtodeveloper@outlook.com> wrote:
If I create a postgres's FUNCTION(myfunc()) using C languageand use this FUNCTION to call the odbc driver(psqlodbcw.so),this problem may happen.
Why would you want to do that? ODBC driver should run as a client process and should not need to interact in any way with a Postgres server process, aka an internal session of the instance.
--
Michael
Вложения

Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

От
Michael Paquier
Дата:


On Wed, Oct 29, 2014 at 2:35 AM, rohtodeveloper <rohtodeveloper@outlook.com> wrote:
Well ,in fact, if I use the extension called odbc_fdw , the same problem will happen.
That’s because the odbc_fdw will also call the odbc driver.
The follow pictures explain the situation.
Ah, right, I completely forgot this fdw. Yeah it may be worth renaming that in the odbc driver... Inoue-san, Saito-san, Heikki, thoughts about the simple patch attached? check_client_encoding is used to extract an encoding name from the connection settings. Perhaps we could do better than that.
--
Michael
Вложения
Michael Paquier <michael.paquier@gmail.com> writes:
> On Wed, Oct 29, 2014 at 2:35 AM, rohtodeveloper <rohtodeveloper@outlook.com>
>> That's because the odbc_fdw will also call the odbc driver.
>> The follow pictures explain the situation.

> Ah, right, I completely forgot this fdw. Yeah it may be worth renaming that
> in the odbc driver... Inoue-san, Saito-san, Heikki, thoughts about the
> simple patch attached? check_client_encoding is used to extract an encoding
> name from the connection settings. Perhaps we could do better than that.

It's totally unmaintainable to expect that no global names inside the
backend will ever accidentally match global names in loaded modules.
What we need to be thinking about is why the linker is resolving the name
wrong and how that can be fixed.  I'm inclined to think that this report
indicates a poor choice of link options while building the ODBC library.

            regards, tom lane


Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

От
"Inoue, Hiroshi"
Дата:
(2014/10/29 2:49), rohtodeveloper wrote:
> I'm so sorry, it seems that there was something wrong with the pictures
> in my last letter.
> Here I send the mail again with the correct pictures:
>
> Thanks a lot for your answer.
>
> Well ,in fact, if I use the extension called odbc_fdw , the same problem
> will happen.
>
> That’s because the odbc_fdw will also call the odbc driver.
>
> The follow pictures explain the situation.
>
> When use the odbc_fdw extension, the libraries are loaded in the
> following way.
>
> After all the libraries are loaded, When the function
> check_client_encoding is called , the whole postgres process will crash
> , result in a core dumped problem.

Which check_client_encoding() call causes the crash?

regards,
Hiroshi Inoue


--
I am using the free version of SPAMfighter.
SPAMfighter has removed 12846 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

Do you have a slow PC? Try a Free scan
http://www.spamfighter.com/SLOW-PCfighter?cid=sigen



Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

От
"Inoue, Hiroshi"
Дата:
(2014/10/29 12:32), Inoue, Hiroshi wrote:
> (2014/10/29 2:49), rohtodeveloper wrote:
>> I'm so sorry, it seems that there was something wrong with the pictures
>> in my last letter.
>> Here I send the mail again with the correct pictures:
>>
>> Thanks a lot for your answer.
>>
>> Well ,in fact, if I use the extension called odbc_fdw , the same problem
>> will happen.
>>
>> That’s because the odbc_fdw will also call the odbc driver.
>>
>> The follow pictures explain the situation.
>>
>> When use the odbc_fdw extension, the libraries are loaded in the
>> following way.
>>
>> After all the libraries are loaded, When the function
>> check_client_encoding is called , the whole postgres process will crash
>> , result in a core dumped problem.
>
> Which check_client_encoding() call causes the crash?

Oops I missed your anothe post.
OK check_client_encoding() in the driver causes the crash.
Currently all global symbols in the driver are exported.
Exporting only ODBC APIs may solve the problem.

regards,
Hiroshi Inoue


--
I am using the free version of SPAMfighter.
SPAMfighter has removed 12846 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

Do you have a slow PC? Try a Free scan
http://www.spamfighter.com/SLOW-PCfighter?cid=sigen



Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.

От
"Inoue, Hiroshi"
Дата:
(2014/10/29 18:02), Inoue, Hiroshi wrote:
> (2014/10/29 12:32), Inoue, Hiroshi wrote:
>> (2014/10/29 2:49), rohtodeveloper wrote:
>>> I'm so sorry, it seems that there was something wrong with the pictures
>>> in my last letter.
>>> Here I send the mail again with the correct pictures:
>>>
>>> Thanks a lot for your answer.
>>>
>>> Well ,in fact, if I use the extension called odbc_fdw , the same problem
>>> will happen.
>>>
>>> That’s because the odbc_fdw will also call the odbc driver.
>>>
>>> The follow pictures explain the situation.
>>>
>>> When use the odbc_fdw extension, the libraries are loaded in the
>>> following way.
>>>
>>> After all the libraries are loaded, When the function
>>> check_client_encoding is called , the whole postgres process will crash
>>> , result in a core dumped problem.
>>
>> Which check_client_encoding() call causes the crash?
>
> Oops I missed your anothe post.
> OK check_client_encoding() in the driver causes the crash.
> Currently all global symbols in the driver are exported.
> Exporting only ODBC APIs may solve the problem.

Possibly attached patch for Makefile.am fixes the problem.
Autoreconf, configure, make and make install are needed.
Could you try it?

regards,
Hiroshi Inoue

--
I am using the free version of SPAMfighter.
SPAMfighter has removed 12852 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

Do you have a slow PC? Try a Free scan
http://www.spamfighter.com/SLOW-PCfighter?cid=sigen

Вложения