Thread: 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.
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 language,and 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!
Attachment
Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.
If I create a postgres's FUNCTION(myfunc()) using C language,and use this FUNCTION to call the odbc driver(psqlodbcw.so),this problem may happen.
Michael
Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.
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.
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
If I create a postgres's FUNCTION(myfunc()) using C language,and use this FUNCTION to call the odbc driver(psqlodbcw.so),this problem may happen.
Michael
Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.
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,
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.
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
If I create a postgres's FUNCTION(myfunc()) using C language,and use this FUNCTION to call the odbc driver(psqlodbcw.so),this problem may happen.
Michael
Attachment
Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.
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.
Michael
Attachment
Re: This may be a bug: odbc's function"check_client_encoding" have the same name with postgres's function.
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.
(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.
(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.
(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