Unix domain socket

Unix domain socket

am 07.02.2005 15:26:24 von Ramon Danieli

Hi,
I hope I'm posting to the right place...
I have successfully connected PostGre server using unixODBC and libodbcpsql=
..so
driver (the one that comes with unixODBC) through PostGre's unix domain soc=
ket
stream. Trying the same with psqlodbc.so fails. From a brief look in the
sources, it seems that psqlodbc.so does NOT support unix domain sockets at
all.
Is that true?
Environment details: OS - RedHat Linux AS 3.90 (Nahant) beta; PostGre - 7.3=
..6
(not RPM); Driver - postgresql-odbc-7.3-8.i386.rpm; unixODBC -
postgresql-odbc-7.3-8.i386.rpm.
Thanks,
Ramon

------------------------------------------------------------ ----
This message was sent using IMP, the Internet Messaging Program.


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Re: Unix domain socket

am 09.02.2005 08:10:10 von Dave Page

-----Original Message-----
From: pgsql-odbc-owner@postgresql.org on behalf of Ramon Danieli
Sent: Mon 2/7/2005 2:26 PM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] Unix domain socket
=20
> it seems that psqlodbc.so does NOT support unix domain sockets at all.
> Is that true?

Yes. psqlODBC was written on Windows and ported to Unix. No-one ever had th=
e itch to add uds support.

Regards, Dave

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Re: Unix domain socket

am 17.02.2005 16:06:17 von Ramon Danieli

Quoting Dave Page :

>
> > it seems that psqlodbc.so does NOT support unix domain sockets at all.
> > Is that true?
>=20
> Yes. psqlODBC was written on Windows and ported to Unix. No-one ever had =
the
> itch to add uds support.
>=20
> Regards, Dave
>=20

Right...
If we would offer a patch (based on code in the unixODBC PG driver), would =
you
consider to include it sometimes in the (near) future?
Thanks, Ramon

------------------------------------------------------------ ----
This message was sent using IMP, the Internet Messaging Program.


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

ODBCVER > 0x0250

am 17.02.2005 16:14:57 von Ramon Danieli

Hi,
As far as I understand (self experience & web), there are some compilation
issues in 07.03.0200 while setting ODBCVER greater than 2.5.
We have successfully compiled & used the 08.00.0002 snapshot on Linux (assu=
ming
it is relatively stable) and it seems to work fine.
Does anybody have a clue about the time when 08.* will be formally released?
Whar are the major changes between this family and the previous one?
Thanks,
Ramon

------------------------------------------------------------ ----
This message was sent using IMP, the Internet Messaging Program.


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Re: Unix domain socket

am 23.02.2005 10:01:24 von Dave Page

=20

> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org=20
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Ramon Danieli
> Sent: 17 February 2005 15:06
> To: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] Unix domain socket
>=20
> Quoting Dave Page :
>=20
> >
> > > it seems that psqlodbc.so does NOT support unix domain=20
> sockets at all.
> > > Is that true?
> >=20
> > Yes. psqlODBC was written on Windows and ported to Unix.=20
> No-one ever had the
> > itch to add uds support.
> >=20
> > Regards, Dave
> >=20
>=20
> Right...
> If we would offer a patch (based on code in the unixODBC PG=20
> driver), would you
> consider to include it sometimes in the (near) future?
> Thanks, Ramon
>

Sure, it'll be reviewed and applied if suitable.

Regards, Dave

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Re: Unix domain socket

am 23.02.2005 10:09:32 von Ramon Danieli

I'm reposting this one as I've got the feeling that my previous posting got
lost...
Anyways, if we would offer a patch (based on code in the unixODBC PG driver=
) to
provide UDS capability, would you consider to include it sometimes in the
(near) future?
Thanks, Ramon

Quoting Dave Page :
> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org on behalf of Ramon Danieli
> Sent: Mon 2/7/2005 2:26 PM
> To: pgsql-odbc@postgresql.org
> Subject: [ODBC] Unix domain socket
>
> > it seems that psqlodbc.so does NOT support unix domain sockets at all.
> > Is that true?
>=20
> Yes. psqlODBC was written on Windows and ported to Unix. No-one ever had =
the
> itch to add uds support.
>=20
> Regards, Dave
>



------------------------------------------------------------ ----
This message was sent using IMP, the Internet Messaging Program.


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Re: ODBCVER > 0x0250

am 23.02.2005 10:40:32 von Ramon Danieli

Hi again,
Some more information:
The 07.03.0200 seems to leak (memory) while performing thousands of SELECTs.
I did not check it thoroughly, but switching to 07.03.0400 solved the issue.
Environment: RH 4.0AS (Nahant), 7.3.6 PG server, unixODBC-2.2.9-1 RPM and
libodbc++-0.2.3.

And back to my original questions -
What is the estimated time for having 08.* drivers "formally" released?
How stable is this latest snapshot?
Are there any severe known bugs (like the one mentioned in the bug list rel=
ated
to deleted-memory access)?
What are the major differences between 08.* and 07.* versions?

Thanks

Quoting Ramon Danieli :

> Hi,
> As far as I understand (self experience & web), there are some compilation
> issues in 07.03.0200 while setting ODBCVER greater than 2.5.
> We have successfully compiled & used the 08.00.0002 snapshot on Linux
> (assuming
> it is relatively stable) and it seems to work fine.
> Does anybody have a clue about the time when 08.* will be formally releas=
ed?
> Whar are the major changes between this family and the previous one?
> Thanks,
> Ramon
>=20




------------------------------------------------------------ ----
This message was sent using IMP, the Internet Messaging Program.


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: Unix domain socket

am 23.02.2005 23:14:55 von Ramon Danieli

While having another look in the sources (08.00.0004) I have found some code
that seems to provide Unix domain sockets connection in socket.c.
This code depends on "HAVE_UNIX_SOCKETS" macro and seems to allow a single =
hard
coded path (/tmp/...) while providing an empty "ServerName" property in the
connection string.
Can you please explain the nature of this code (it was not available in the
07.03.0200 version)?
What is required (configure, compilation flags, etc`) in order to have this
macro valid (I think that normally this code is not included)?
Why does it have a single hard coded path?
Thanks
Ramon

> > > > it seems that psqlodbc.so does NOT support unix domain=20
> > sockets at all.
> > > > Is that true?
> > >=20
> > > Yes. psqlODBC was written on Windows and ported to Unix.=20
> > No-one ever had the
> > > itch to add uds support.
> > >=20
> > > Regards, Dave
> > >=20
> >=20
> > Right...
> > If we would offer a patch (based on code in the unixODBC PG=20
> > driver), would you
> > consider to include it sometimes in the (near) future?
> > Thanks, Ramon
> >
>=20
> Sure, it'll be reviewed and applied if suitable.
>=20
> Regards, Dave


------------------------------------------------------------ ----
This message was sent using IMP, the Internet Messaging Program.


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Re: Unix domain socket

am 24.02.2005 09:13:36 von Dave Page

=20

> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org=20
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Ramon Danieli
> Sent: 23 February 2005 22:15
> To: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] Unix domain socket
>=20
> While having another look in the sources (08.00.0004) I have=20
> found some code
> that seems to provide Unix domain sockets connection in socket.c.
> This code depends on "HAVE_UNIX_SOCKETS" macro and seems to=20
> allow a single hard
> coded path (/tmp/...) while providing an empty "ServerName"=20
> property in the
> connection string.
> Can you please explain the nature of this code (it was not=20
> available in the
> 07.03.0200 version)?
> What is required (configure, compilation flags, etc`) in=20
> order to have this
> macro valid (I think that normally this code is not included)?
> Why does it have a single hard coded path?

Hmm, did even realise it had crept in there. Well to enable it you will
need to define the HAVE_UNIX_SOCKETS macro when you compile. Does it
then work? As for why it's done the way it is, I have no idea - it was
committed by Hiroshi Inoue, so he'd need to answer that - unfortunately
though, he no longer works on psqlODBC.

Regards, Dave.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: Unix domain socket

am 24.02.2005 21:16:31 von Peter Eisentraut

Dave Page wrote:
> Hmm, did even realise it had crept in there. Well to enable it you
> will need to define the HAVE_UNIX_SOCKETS macro when you compile.
> Does it then work? As for why it's done the way it is, I have no idea
> - it was committed by Hiroshi Inoue, so he'd need to answer that -
> unfortunately though, he no longer works on psqlODBC.

HAVE_UNIX_SOCKETS is defined in the server source tree, so I guess this
could be a leftover from those days. Turn on the macro and see if you
get it working.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Re: Unix domain socket

am 01.03.2005 10:00:59 von Ramon Danieli

Quoting Peter Eisentraut :

> Dave Page wrote:
> > Hmm, did even realise it had crept in there. Well to enable it you
> > will need to define the HAVE_UNIX_SOCKETS macro when you compile.
> > Does it then work? As for why it's done the way it is, I have no idea
> > - it was committed by Hiroshi Inoue, so he'd need to answer that -
> > unfortunately though, he no longer works on psqlODBC.
>=20
> HAVE_UNIX_SOCKETS is defined in the server source tree, so I guess this=
=20
> could be a leftover from those days. Turn on the macro and see if you=20
> get it working.
>=20
> --=20

The macro is turned on automatically (RHL 4.0AS, gcc version 3.4.2 20041017=
(Red
Hat 3.4.2-6.fc3)) and it works.

The following patch allow users to configure the Unix domain socket path,
using the "Uds" property.
I took some code from the unixODBC PG driver and performed the necessary
adjustments.
Please note that unlike unixODBC, I have followed the current convention, w=
hich
means that:
1) "Uds" is considered only if "Servername" is empty.
2) Default path is "/tmp".
3) The provided path should point the folder that comtains the UDS node.

Please let me know if you find anything wrong in this patch and whether it =
will
be included sometimes in the near future.

Thanks,
Ramon


diff -Naur psqlodbc-08.00.0004/connection.c
psqlodbc-08.00.0004.patch/connection.c
--- psqlodbc-08.00.0004/connection.c 2005-01-28 23:36:14.000000000 +0200
+++ psqlodbc-08.00.0004.patch/connection.c 2005-02-27 14:40:34.430232000 +0=
200
@@ -725,7 +725,16 @@
return 0;
}
=20
- mylog("CC_connect(): DSN =3D '%s', server =3D '%s', port =3D '%s', datab=
ase =3D '%s',
username =3D '%s', password=3D'%s'\n", ci->dsn, ci->server, ci->port, ci->d=
atabase,
ci->username, ci->password ? "xxxxx" : "");
+ mylog("CC_connect(): DSN =3D '%s', server =3D '%s', port =3D '%s',"
+#ifdef HAVE_UNIX_SOCKETS
+ " uds =3D '%s',"
+#endif
+ " database =3D '%s', username =3D '%s',"
+ " password=3D'%s'\n", ci->dsn, ci->server, ci->port,
+#ifdef HAVE_UNIX_SOCKETS
+ ci->uds,
+#endif
+ ci->database, ci->username, ci->password ? "xxxxx" : "");
=20
another_version_retry:
=20
@@ -747,7 +756,11 @@
=20
mylog("connecting to the server socket...\n");
=20
- SOCK_connect_to(sock, (short) atoi(ci->port), ci->server);
+ SOCK_connect_to(sock, (short) atoi(ci->port), ci->server
+#ifdef HAVE_UNIX_SOCKETS
+ , ci->uds
+#endif
+ );
if (SOCK_get_errcode(sock) !=3D 0)
{
mylog("connection to the server socket failed.\n");
diff -Naur psqlodbc-08.00.0004/connection.h
psqlodbc-08.00.0004.patch/connection.h
--- psqlodbc-08.00.0004/connection.h 2005-01-28 23:36:14.000000000 +0200
+++ psqlodbc-08.00.0004.patch/connection.h 2005-02-27 16:04:37.469858000 +0=
200
@@ -19,6 +19,10 @@
#include
#endif
=20
+#if !defined WIN32 && defined HAVE_SYS_UN_H && !defined HAVE_UNIX_SOCKETS
+#define HAVE_UNIX_SOCKETS
+#endif
+
typedef enum
{
CONN_NOT_CONNECTED, /* Connection has not been established */
@@ -239,6 +243,9 @@
char conn_settings[LARGE_REGISTRY_LEN];
char protocol[SMALL_REGISTRY_LEN];
char port[SMALL_REGISTRY_LEN];
+#ifdef HAVE_UNIX_SOCKETS
+ char uds[LARGE_REGISTRY_LEN];
+#endif
char onlyread[SMALL_REGISTRY_LEN];
char fake_oid_index[SMALL_REGISTRY_LEN];
char show_oid_column[SMALL_REGISTRY_LEN];
diff -Naur psqlodbc-08.00.0004/dlg_specific.c
psqlodbc-08.00.0004.patch/dlg_specific.c
--- psqlodbc-08.00.0004/dlg_specific.c 2005-01-28 23:36:15.000000000 +0200
+++ psqlodbc-08.00.0004.patch/dlg_specific.c 2005-02-27 16:03:10.559495000
+0200
@@ -286,6 +286,11 @@
else if (stricmp(attribute, INI_PORT) == 0)
strcpy(ci->port, value);
=20
+#ifdef HAVE_UNIX_SOCKETS
+ else if (stricmp(attribute, INI_UDS) == 0)
+ strcpy(ci->uds, value);
+#endif
+
else if (stricmp(attribute, INI_READONLY) == 0 || stricmp(attribute, =
"A0") ==
0)
strcpy(ci->onlyread, value);
=20
@@ -492,6 +497,11 @@
if (ci->port[0] == '\0' || overwrite)
SQLGetPrivateProfileString(DSN, INI_PORT, "", ci->port, sizeof(ci->port),
ODBC_INI);
=20
+#ifdef HAVE_UNIX_SOCKETS
+ if (ci->uds[0] == '\0' || overwrite)
+ SQLGetPrivateProfileString(DSN, INI_UDS, "", ci->uds, sizeof(ci->uds),
ODBC_INI);
+#endif
+
if (ci->onlyread[0] == '\0' || overwrite)
SQLGetPrivateProfileString(DSN, INI_READONLY, "", ci->onlyread,
sizeof(ci->onlyread), ODBC_INI);
=20
@@ -725,6 +735,13 @@
ci->port,
ODBC_INI);
=20
+#ifdef HAVE_UNIX_SOCKETS
+ SQLWritePrivateProfileString(DSN,
+ INI_UDS,
+ ci->uds,
+ ODBC_INI);
+#endif
+
SQLWritePrivateProfileString(DSN,
INI_USER,
ci->username,
diff -Naur psqlodbc-08.00.0004/dlg_specific.h
psqlodbc-08.00.0004.patch/dlg_specific.h
--- psqlodbc-08.00.0004/dlg_specific.h 2005-01-28 23:36:15.000000000 +0200
+++ psqlodbc-08.00.0004.patch/dlg_specific.h 2005-02-27 14:10:03.393190000
+0200
@@ -38,6 +38,14 @@
#define INI_KDESC "Description" /* Data source description */
#define INI_SERVER "Servername" /* Name of Server running PostgreSQL */
#define INI_PORT "Port" /* Port on which the Postmaster is listening */
+
+#if !defined WIN32 && defined HAVE_SYS_UN_H
+#ifndef HAVE_UNIX_SOCKETS
+#define HAVE_UNIX_SOCKETS
+#endif
+#define INI_UDS "Uds" /* Unix domain socket path*/
+#endif
+
#define INI_DATABASE "Database" /* Database Name */
#define INI_USER "Username" /* Default User Name */
#define INI_PASSWORD "Password" /* Default Password */
diff -Naur psqlodbc-08.00.0004/socket.c psqlodbc-08.00.0004.patch/socket.c
--- psqlodbc-08.00.0004/socket.c 2005-01-28 23:36:20.000000000 +0200
+++ psqlodbc-08.00.0004.patch/socket.c 2005-02-27 16:20:34.993553000 +0200
@@ -109,7 +109,11 @@
=20
=20
char
-SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname)
+SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname
+#ifdef HAVE_UNIX_SOCKETS
+ , char *uds /* unix domain socket path */
+#endif
+ )
{
#if defined (POSIX_MULTITHREAD_SUPPORT)
const int bufsz =3D 8192;=20
@@ -140,7 +144,7 @@
=20
=20
/*
- * If it is a valid IP address, use it. Otherwise use hostname lookup.
+ * If it is a valid IP address, use it. Otherwise use AF_UNIX socket.
*/
if (hostname && hostname[0])
{
@@ -196,7 +200,7 @@
}
un->sun_family =3D family =3D AF_UNIX;
/* passing NULL means that this only suports the pg default "/tmp" */
- UNIXSOCK_PATH(un, port, ((char *) NULL));
+ UNIXSOCK_PATH(un, port, uds);
sLen =3D UNIXSOCK_LEN(un);
self->sadr =3D (struct sockaddr *) un;
}
diff -Naur psqlodbc-08.00.0004/socket.h psqlodbc-08.00.0004.patch/socket.h
--- psqlodbc-08.00.0004/socket.h 2005-01-28 23:36:20.000000000 +0200
+++ psqlodbc-08.00.0004.patch/socket.h 2005-02-27 16:18:22.733047000 +0200
@@ -34,7 +34,7 @@
=20
#define SOCK_ERRNO errno
#define SOCK_ERRNO_SET(e) (errno =3D e)
-#ifdef HAVE_SYS_UN_H
+#if defined HAVE_SYS_UN_H && !defined HAVE_UNIX_SOCKETS
#define HAVE_UNIX_SOCKETS
#endif /* HAVE_SYS_UN_H */
#else
@@ -121,7 +121,12 @@
/* Socket prototypes */
SocketClass *SOCK_Constructor(const ConnectionClass *conn);
void SOCK_Destructor(SocketClass *self);
-char SOCK_connect_to(SocketClass *self, unsigned short port, char *hostna=
me);
+char SOCK_connect_to(SocketClass *self, unsigned short port,
+ char *hostname
+#ifdef HAVE_UNIX_SOCKETS
+ , char *uds
+#endif
+ );
void SOCK_get_n_char(SocketClass *self, char *buffer, int len);
void SOCK_put_n_char(SocketClass *self, char *buffer, int len);
BOOL SOCK_get_string(SocketClass *self, char *buffer, int bufsize);


------------------------------------------------------------ ----
This message was sent using IMP, the Internet Messaging Program.


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: Unix domain socket

am 02.03.2005 16:11:56 von Dave Page

Thanks Ramon, patch applied.

Regards, Dave.=20

> -----Original Message-----
> From: Ramon Danieli [mailto:ramond@post.tau.ac.il]=20
> Sent: 01 March 2005 09:01
> To: pgsql-odbc@postgresql.org
> Cc: Dave Page; Peter Eisentraut
> Subject: Re: [ODBC] Unix domain socket
>=20
> Quoting Peter Eisentraut :
>=20
> > Dave Page wrote:
> > > Hmm, did even realise it had crept in there. Well to enable it you
> > > will need to define the HAVE_UNIX_SOCKETS macro when you compile.
> > > Does it then work? As for why it's done the way it is, I=20
> have no idea
> > > - it was committed by Hiroshi Inoue, so he'd need to answer that -
> > > unfortunately though, he no longer works on psqlODBC.
> >=20
> > HAVE_UNIX_SOCKETS is defined in the server source tree, so=20
> I guess this=20
> > could be a leftover from those days. Turn on the macro and=20
> see if you=20
> > get it working.
> >=20
> > --=20
>=20
> The macro is turned on automatically (RHL 4.0AS, gcc version=20
> 3.4.2 20041017 (Red
> Hat 3.4.2-6.fc3)) and it works.
>=20
> The following patch allow users to configure the Unix domain=20
> socket path,
> using the "Uds" property.
> I took some code from the unixODBC PG driver and performed=20
> the necessary
> adjustments.
> Please note that unlike unixODBC, I have followed the current=20
> convention, which
> means that:
> 1) "Uds" is considered only if "Servername" is empty.
> 2) Default path is "/tmp".
> 3) The provided path should point the folder that comtains=20
> the UDS node.
>=20
> Please let me know if you find anything wrong in this patch=20
> and whether it will
> be included sometimes in the near future.
>=20
> Thanks,
> Ramon
>=20
>=20
> diff -Naur psqlodbc-08.00.0004/connection.c
> psqlodbc-08.00.0004.patch/connection.c
> --- psqlodbc-08.00.0004/connection.c 2005-01-28=20
> 23:36:14.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/connection.c 2005-02-27=20
> 14:40:34.430232000 +0200
> @@ -725,7 +725,16 @@
> return 0;
> }
>
> - mylog("CC_connect(): DSN =3D '%s', server =3D '%s',=20
> port =3D '%s', database =3D '%s',
> username =3D '%s', password=3D'%s'\n", ci->dsn, ci->server,=20
> ci->port, ci->database,
> ci->username, ci->password ? "xxxxx" : "");
> + mylog("CC_connect(): DSN =3D '%s', server =3D '%s',=20
> port =3D '%s',"
> +#ifdef HAVE_UNIX_SOCKETS
> + " uds =3D '%s',"
> +#endif
> + " database =3D '%s', username =3D '%s',"
> + " password=3D'%s'\n", ci->dsn, ci->server, ci->port,
> +#ifdef HAVE_UNIX_SOCKETS
> + ci->uds,
> +#endif
> + ci->database, ci->username, ci->password=20
> ? "xxxxx" : "");
>
> another_version_retry:
>
> @@ -747,7 +756,11 @@
>
> mylog("connecting to the server socket...\n");
>
> - SOCK_connect_to(sock, (short) atoi(ci->port),=20
> ci->server);
> + SOCK_connect_to(sock, (short) atoi(ci->port), ci->server
> +#ifdef HAVE_UNIX_SOCKETS
> + , ci->uds
> +#endif
> + );
> if (SOCK_get_errcode(sock) !=3D 0)
> {
> mylog("connection to the server socket=20
> failed.\n");
> diff -Naur psqlodbc-08.00.0004/connection.h
> psqlodbc-08.00.0004.patch/connection.h
> --- psqlodbc-08.00.0004/connection.h 2005-01-28=20
> 23:36:14.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/connection.h 2005-02-27=20
> 16:04:37.469858000 +0200
> @@ -19,6 +19,10 @@
> #include
> #endif
>
> +#if !defined WIN32 && defined HAVE_SYS_UN_H && !defined=20
> HAVE_UNIX_SOCKETS
> +#define HAVE_UNIX_SOCKETS
> +#endif
> +
> typedef enum
> {
> CONN_NOT_CONNECTED, /* Connection=20
> has not been established */
> @@ -239,6 +243,9 @@
> char conn_settings[LARGE_REGISTRY_LEN];
> char protocol[SMALL_REGISTRY_LEN];
> char port[SMALL_REGISTRY_LEN];
> +#ifdef HAVE_UNIX_SOCKETS
> + char uds[LARGE_REGISTRY_LEN];
> +#endif
> char onlyread[SMALL_REGISTRY_LEN];
> char fake_oid_index[SMALL_REGISTRY_LEN];
> char show_oid_column[SMALL_REGISTRY_LEN];
> diff -Naur psqlodbc-08.00.0004/dlg_specific.c
> psqlodbc-08.00.0004.patch/dlg_specific.c
> --- psqlodbc-08.00.0004/dlg_specific.c 2005-01-28=20
> 23:36:15.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/dlg_specific.c 2005-02-27=20
> 16:03:10.559495000
> +0200
> @@ -286,6 +286,11 @@
> else if (stricmp(attribute, INI_PORT) == 0)
> strcpy(ci->port, value);
>
> +#ifdef HAVE_UNIX_SOCKETS
> + else if (stricmp(attribute, INI_UDS) == 0)
> + strcpy(ci->uds, value);
> +#endif
> +
> else if (stricmp(attribute, INI_READONLY) == 0 ||=20
> stricmp(attribute, "A0") ==
> 0)
> strcpy(ci->onlyread, value);
>
> @@ -492,6 +497,11 @@
> if (ci->port[0] == '\0' || overwrite)
> SQLGetPrivateProfileString(DSN, INI_PORT, "",=20
> ci->port, sizeof(ci->port),
> ODBC_INI);
>
> +#ifdef HAVE_UNIX_SOCKETS
> + if (ci->uds[0] == '\0' || overwrite)
> + SQLGetPrivateProfileString(DSN, INI_UDS, "",=20
> ci->uds, sizeof(ci->uds),
> ODBC_INI);
> +#endif
> +
> if (ci->onlyread[0] == '\0' || overwrite)
> SQLGetPrivateProfileString(DSN, INI_READONLY,=20
> "", ci->onlyread,
> sizeof(ci->onlyread), ODBC_INI);
>
> @@ -725,6 +735,13 @@
>
> ci->port,
>
> ODBC_INI);
>
> +#ifdef HAVE_UNIX_SOCKETS
> + SQLWritePrivateProfileString(DSN,
> +
> INI_UDS,
> +
> ci->uds,
> +
> ODBC_INI);
> +#endif
> +
> SQLWritePrivateProfileString(DSN,
>
> INI_USER,
>
> ci->username,
> diff -Naur psqlodbc-08.00.0004/dlg_specific.h
> psqlodbc-08.00.0004.patch/dlg_specific.h
> --- psqlodbc-08.00.0004/dlg_specific.h 2005-01-28=20
> 23:36:15.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/dlg_specific.h 2005-02-27=20
> 14:10:03.393190000
> +0200
> @@ -38,6 +38,14 @@
> #define INI_KDESC "Description" /* Data=20
> source description */
> #define INI_SERVER "Servername" /* Name=20
> of Server running PostgreSQL */
> #define INI_PORT "Port" /* Port=20
> on which the Postmaster is listening */
> +
> +#if !defined WIN32 && defined HAVE_SYS_UN_H
> +#ifndef HAVE_UNIX_SOCKETS
> +#define HAVE_UNIX_SOCKETS
> +#endif
> +#define INI_UDS "Uds"
> /* Unix domain socket path*/
> +#endif
> +
> #define INI_DATABASE "Database" /*=20
> Database Name */
> #define INI_USER "Username" /*=20
> Default User Name */
> #define INI_PASSWORD "Password" /*=20
> Default Password */
> diff -Naur psqlodbc-08.00.0004/socket.c=20
> psqlodbc-08.00.0004.patch/socket.c
> --- psqlodbc-08.00.0004/socket.c 2005-01-28=20
> 23:36:20.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/socket.c 2005-02-27=20
> 16:20:34.993553000 +0200
> @@ -109,7 +109,11 @@
>
>
> char
> -SOCK_connect_to(SocketClass *self, unsigned short port, char=20
> *hostname)
> +SOCK_connect_to(SocketClass *self, unsigned short port, char=20
> *hostname
> +#ifdef HAVE_UNIX_SOCKETS
> + , char *uds /* unix domain socket path */
> +#endif
> + )
> {
> #if defined (POSIX_MULTITHREAD_SUPPORT)
> const int bufsz =3D 8192;=20
> @@ -140,7 +144,7 @@
>
>
> /*
> - * If it is a valid IP address, use it. Otherwise use=20
> hostname lookup.
> + * If it is a valid IP address, use it. Otherwise use=20
> AF_UNIX socket.
> */
> if (hostname && hostname[0])
> {
> @@ -196,7 +200,7 @@
> }
> un->sun_family =3D family =3D AF_UNIX;
> /* passing NULL means that this only suports=20
> the pg default "/tmp" */
> - UNIXSOCK_PATH(un, port, ((char *) NULL));
> + UNIXSOCK_PATH(un, port, uds);
> sLen =3D UNIXSOCK_LEN(un);
> self->sadr =3D (struct sockaddr *) un;
> }
> diff -Naur psqlodbc-08.00.0004/socket.h=20
> psqlodbc-08.00.0004.patch/socket.h
> --- psqlodbc-08.00.0004/socket.h 2005-01-28=20
> 23:36:20.000000000 +0200
> +++ psqlodbc-08.00.0004.patch/socket.h 2005-02-27=20
> 16:18:22.733047000 +0200
> @@ -34,7 +34,7 @@
>
> #define SOCK_ERRNO errno
> #define SOCK_ERRNO_SET(e) (errno =3D e)
> -#ifdef HAVE_SYS_UN_H
> +#if defined HAVE_SYS_UN_H && !defined HAVE_UNIX_SOCKETS
> #define HAVE_UNIX_SOCKETS
> #endif /* HAVE_SYS_UN_H */
> #else
> @@ -121,7 +121,12 @@
> /* Socket prototypes */
> SocketClass *SOCK_Constructor(const ConnectionClass *conn);
> void SOCK_Destructor(SocketClass *self);
> -char SOCK_connect_to(SocketClass *self, unsigned=20
> short port, char *hostname);
> +char SOCK_connect_to(SocketClass *self, unsigned short port,
> + char *hostname
> +#ifdef HAVE_UNIX_SOCKETS
> + , char *uds
> +#endif
> + );
> void SOCK_get_n_char(SocketClass *self, char=20
> *buffer, int len);
> void SOCK_put_n_char(SocketClass *self, char=20
> *buffer, int len);
> BOOL SOCK_get_string(SocketClass *self, char=20
> *buffer, int bufsize);
>=20
>=20
> ------------------------------------------------------------ ----
> This message was sent using IMP, the Internet Messaging Program.
>=20
>=20

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Re: Unix domain socket

am 02.03.2005 16:31:15 von Peter Eisentraut

Am Dienstag, 1. März 2005 10:00 schrieb Ramon Danieli:
> The following patch allow users to configure the Unix domain socket pat=
h,
> using the "Uds" property.

For consistency with libpq, the Unix domain socket path should probably=20
configured through the hostname.

--=20
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Re: ODBCVER > 0x0250

am 02.03.2005 23:40:25 von Peter Bense

Does anyone know if Ramon's "documented" bugs have been addressed by the
latest release?

../peter

Peter T. Bense - Teradata Certified Professional
(ptbense@gwm.sc.edu) - 803-777-9476
Database Administrator/Webmaster
Prevention Research Center
University of South Carolina

>>> Ramon Danieli 2/23/2005 4:40:32 AM >>>
Hi again,
Some more information:
The 07.03.0200 seems to leak (memory) while performing thousands of
SELECTs.
I did not check it thoroughly, but switching to 07.03.0400 solved the
issue.
Environment: RH 4.0AS (Nahant), 7.3.6 PG server, unixODBC-2.2.9-1 RPM
and
libodbc++-0.2.3.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Re: Unix domain socket

am 17.04.2007 10:26:11 von Ramon Danieli

Hi Dave,

Could u please let me know in which version this patch was eventually inclu=
ded?
Currently we still use our own modified driver (based on the 08.00.0004) an=
d we
would like to upgrade.
Our best option would be to use a standard RedHat RPM (4.0/5.0 AS famiy).
Otherwise, we would use the latest from your site.
Thanks,
Ramon

BTW - the link to the original thread:
http://archives.postgresql.org/pgsql-odbc/2005-03/msg00010.p hp


Quoting Dave Page :

> Thanks Ramon, patch applied.
>
> Regards, Dave.
>
> > -----Original Message-----
> > From: Ramon Danieli [mailto:ramond@post.tau.ac.il]
> > Sent: 01 March 2005 09:01
> > To: pgsql-odbc@postgresql.org
> > Cc: Dave Page; Peter Eisentraut
> > Subject: Re: [ODBC] Unix domain socket
> >
> > Quoting Peter Eisentraut :
> >
> > > Dave Page wrote:
> > > > Hmm, did even realise it had crept in there. Well to enable it you
> > > > will need to define the HAVE_UNIX_SOCKETS macro when you compile.
> > > > Does it then work? As for why it's done the way it is, I
> > have no idea
> > > > - it was committed by Hiroshi Inoue, so he'd need to answer that -
> > > > unfortunately though, he no longer works on psqlODBC.
> > >
> > > HAVE_UNIX_SOCKETS is defined in the server source tree, so
> > I guess this
> > > could be a leftover from those days. Turn on the macro and
> > see if you
> > > get it working.
> > >
> > > --
> >
> > The macro is turned on automatically (RHL 4.0AS, gcc version
> > 3.4.2 20041017 (Red
> > Hat 3.4.2-6.fc3)) and it works.
> >
> > The following patch allow users to configure the Unix domain
> > socket path,
> > using the "Uds" property.
> > I took some code from the unixODBC PG driver and performed
> > the necessary
> > adjustments.
> > Please note that unlike unixODBC, I have followed the current
> > convention, which
> > means that:
> > 1) "Uds" is considered only if "Servername" is empty.
> > 2) Default path is "/tmp".
> > 3) The provided path should point the folder that comtains
> > the UDS node.
> >
> > Please let me know if you find anything wrong in this patch
> > and whether it will
> > be included sometimes in the near future.
> >
> > Thanks,
> > Ramon
> >
> >
> > diff -Naur psqlodbc-08.00.0004/connection.c
> > psqlodbc-08.00.0004.patch/connection.c
> > --- psqlodbc-08.00.0004/connection.c 2005-01-28
> > 23:36:14.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/connection.c 2005-02-27
> > 14:40:34.430232000 +0200
> > @@ -725,7 +725,16 @@
> > return 0;
> > }
> >
> > - mylog("CC_connect(): DSN =3D '%s', server =3D '%s',
> > port =3D '%s', database =3D '%s',
> > username =3D '%s', password=3D'%s'\n", ci->dsn, ci->server,
> > ci->port, ci->database,
> > ci->username, ci->password ? "xxxxx" : "");
> > + mylog("CC_connect(): DSN =3D '%s', server =3D '%s',
> > port =3D '%s',"
> > +#ifdef HAVE_UNIX_SOCKETS
> > + " uds =3D '%s',"
> > +#endif
> > + " database =3D '%s', username =3D '%s',"
> > + " password=3D'%s'\n", ci->dsn, ci->server, ci->port,
> > +#ifdef HAVE_UNIX_SOCKETS
> > + ci->uds,
> > +#endif
> > + ci->database, ci->username, ci->password
> > ? "xxxxx" : "");
> >
> > another_version_retry:
> >
> > @@ -747,7 +756,11 @@
> >
> > mylog("connecting to the server socket...\n");
> >
> > - SOCK_connect_to(sock, (short) atoi(ci->port),
> > ci->server);
> > + SOCK_connect_to(sock, (short) atoi(ci->port), ci->server
> > +#ifdef HAVE_UNIX_SOCKETS
> > + , ci->uds
> > +#endif
> > + );
> > if (SOCK_get_errcode(sock) !=3D 0)
> > {
> > mylog("connection to the server socket
> > failed.\n");
> > diff -Naur psqlodbc-08.00.0004/connection.h
> > psqlodbc-08.00.0004.patch/connection.h
> > --- psqlodbc-08.00.0004/connection.h 2005-01-28
> > 23:36:14.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/connection.h 2005-02-27
> > 16:04:37.469858000 +0200
> > @@ -19,6 +19,10 @@
> > #include
> > #endif
> >
> > +#if !defined WIN32 && defined HAVE_SYS_UN_H && !defined
> > HAVE_UNIX_SOCKETS
> > +#define HAVE_UNIX_SOCKETS
> > +#endif
> > +
> > typedef enum
> > {
> > CONN_NOT_CONNECTED, /* Connection
> > has not been established */
> > @@ -239,6 +243,9 @@
> > char conn_settings[LARGE_REGISTRY_LEN];
> > char protocol[SMALL_REGISTRY_LEN];
> > char port[SMALL_REGISTRY_LEN];
> > +#ifdef HAVE_UNIX_SOCKETS
> > + char uds[LARGE_REGISTRY_LEN];
> > +#endif
> > char onlyread[SMALL_REGISTRY_LEN];
> > char fake_oid_index[SMALL_REGISTRY_LEN];
> > char show_oid_column[SMALL_REGISTRY_LEN];
> > diff -Naur psqlodbc-08.00.0004/dlg_specific.c
> > psqlodbc-08.00.0004.patch/dlg_specific.c
> > --- psqlodbc-08.00.0004/dlg_specific.c 2005-01-28
> > 23:36:15.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/dlg_specific.c 2005-02-27
> > 16:03:10.559495000
> > +0200
> > @@ -286,6 +286,11 @@
> > else if (stricmp(attribute, INI_PORT) == 0)
> > strcpy(ci->port, value);
> >
> > +#ifdef HAVE_UNIX_SOCKETS
> > + else if (stricmp(attribute, INI_UDS) == 0)
> > + strcpy(ci->uds, value);
> > +#endif
> > +
> > else if (stricmp(attribute, INI_READONLY) == 0 ||
> > stricmp(attribute, "A0") ==
> > 0)
> > strcpy(ci->onlyread, value);
> >
> > @@ -492,6 +497,11 @@
> > if (ci->port[0] == '\0' || overwrite)
> > SQLGetPrivateProfileString(DSN, INI_PORT, "",
> > ci->port, sizeof(ci->port),
> > ODBC_INI);
> >
> > +#ifdef HAVE_UNIX_SOCKETS
> > + if (ci->uds[0] == '\0' || overwrite)
> > + SQLGetPrivateProfileString(DSN, INI_UDS, "",
> > ci->uds, sizeof(ci->uds),
> > ODBC_INI);
> > +#endif
> > +
> > if (ci->onlyread[0] == '\0' || overwrite)
> > SQLGetPrivateProfileString(DSN, INI_READONLY,
> > "", ci->onlyread,
> > sizeof(ci->onlyread), ODBC_INI);
> >
> > @@ -725,6 +735,13 @@
> >
> > ci->port,
> >
> > ODBC_INI);
> >
> > +#ifdef HAVE_UNIX_SOCKETS
> > + SQLWritePrivateProfileString(DSN,
> > +
> > INI_UDS,
> > +
> > ci->uds,
> > +
> > ODBC_INI);
> > +#endif
> > +
> > SQLWritePrivateProfileString(DSN,
> >
> > INI_USER,
> >
> > ci->username,
> > diff -Naur psqlodbc-08.00.0004/dlg_specific.h
> > psqlodbc-08.00.0004.patch/dlg_specific.h
> > --- psqlodbc-08.00.0004/dlg_specific.h 2005-01-28
> > 23:36:15.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/dlg_specific.h 2005-02-27
> > 14:10:03.393190000
> > +0200
> > @@ -38,6 +38,14 @@
> > #define INI_KDESC "Description" /* Data
> > source description */
> > #define INI_SERVER "Servername" /* Name
> > of Server running PostgreSQL */
> > #define INI_PORT "Port" /* Port
> > on which the Postmaster is listening */
> > +
> > +#if !defined WIN32 && defined HAVE_SYS_UN_H
> > +#ifndef HAVE_UNIX_SOCKETS
> > +#define HAVE_UNIX_SOCKETS
> > +#endif
> > +#define INI_UDS "Uds"
> > /* Unix domain socket path*/
> > +#endif
> > +
> > #define INI_DATABASE "Database" /*
> > Database Name */
> > #define INI_USER "Username" /*
> > Default User Name */
> > #define INI_PASSWORD "Password" /*
> > Default Password */
> > diff -Naur psqlodbc-08.00.0004/socket.c
> > psqlodbc-08.00.0004.patch/socket.c
> > --- psqlodbc-08.00.0004/socket.c 2005-01-28
> > 23:36:20.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/socket.c 2005-02-27
> > 16:20:34.993553000 +0200
> > @@ -109,7 +109,11 @@
> >
> >
> > char
> > -SOCK_connect_to(SocketClass *self, unsigned short port, char
> > *hostname)
> > +SOCK_connect_to(SocketClass *self, unsigned short port, char
> > *hostname
> > +#ifdef HAVE_UNIX_SOCKETS
> > + , char *uds /* unix domain socket path */
> > +#endif
> > + )
> > {
> > #if defined (POSIX_MULTITHREAD_SUPPORT)
> > const int bufsz =3D 8192;
> > @@ -140,7 +144,7 @@
> >
> >
> > /*
> > - * If it is a valid IP address, use it. Otherwise use
> > hostname lookup.
> > + * If it is a valid IP address, use it. Otherwise use
> > AF_UNIX socket.
> > */
> > if (hostname && hostname[0])
> > {
> > @@ -196,7 +200,7 @@
> > }
> > un->sun_family =3D family =3D AF_UNIX;
> > /* passing NULL means that this only suports
> > the pg default "/tmp" */
> > - UNIXSOCK_PATH(un, port, ((char *) NULL));
> > + UNIXSOCK_PATH(un, port, uds);
> > sLen =3D UNIXSOCK_LEN(un);
> > self->sadr =3D (struct sockaddr *) un;
> > }
> > diff -Naur psqlodbc-08.00.0004/socket.h
> > psqlodbc-08.00.0004.patch/socket.h
> > --- psqlodbc-08.00.0004/socket.h 2005-01-28
> > 23:36:20.000000000 +0200
> > +++ psqlodbc-08.00.0004.patch/socket.h 2005-02-27
> > 16:18:22.733047000 +0200
> > @@ -34,7 +34,7 @@
> >
> > #define SOCK_ERRNO errno
> > #define SOCK_ERRNO_SET(e) (errno =3D e)
> > -#ifdef HAVE_SYS_UN_H
> > +#if defined HAVE_SYS_UN_H && !defined HAVE_UNIX_SOCKETS
> > #define HAVE_UNIX_SOCKETS
> > #endif /* HAVE_SYS_UN_H */
> > #else
> > @@ -121,7 +121,12 @@
> > /* Socket prototypes */
> > SocketClass *SOCK_Constructor(const ConnectionClass *conn);
> > void SOCK_Destructor(SocketClass *self);
> > -char SOCK_connect_to(SocketClass *self, unsigned
> > short port, char *hostname);
> > +char SOCK_connect_to(SocketClass *self, unsigned short port,
> > + char *hostname
> > +#ifdef HAVE_UNIX_SOCKETS
> > + , char *uds
> > +#endif
> > + );
> > void SOCK_get_n_char(SocketClass *self, char
> > *buffer, int len);
> > void SOCK_put_n_char(SocketClass *self, char
> > *buffer, int len);
> > BOOL SOCK_get_string(SocketClass *self, char
> > *buffer, int bufsize);
> >
> >
> > ------------------------------------------------------------ ----
> > This message was sent using IMP, the Internet Messaging Program.
> >
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
> +++++++++++++++++++++++++++++++++++++++++++
> This Mail Was Scanned By Mail-seCure System
> at the Tel-Aviv University CC.
>

------------------------------------------------------------ ----
This message was sent using IMP, the Internet Messaging Program.


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org