Thread: Patch for TNS services
-----BEGIN PGP SIGNED MESSAGE----- Last week I created a patch for the Postgres client side libraries to allow something like a (not so mighty) form of Oracle TNS, but nobody showed any interest. Currently, the patch is not perfect yet, but works fine for us. I want to avoid improving the patch if there is no interest in it, so if you think it might be a worthy improvement please drop me a line. It works like this: The patch allows to supply another parameter to the Postgres connect string, called "service". So, instead of having a connect string (e.g. in PHP) like "dbname=foo host=bar port=5433 user=foouser password=barpass" the string would be "service=stupid_name_here" or more often "service=stupid_name_here user=foouser password=barpass" There's a config file /etc/pg_service.conf, having an entry like: [stupid_name_here] dbname=foo host=bar port=5433 .... The advantage is you can go from one database host, database, port or whatever without having to touch the scripts or applications. We're currently in the process of migrating all of our PHP and Python scripts to another from localhost, port 5433 to another machine, port 5432 and it's not something I ever want to do again, I'd to change around 100 files and I'm still not sure if I've missed one. The patch is client-side only, around 100 lines, needs no changes to the backend and is compatible with all applications supplying a connection string (not using PQsetdblogin) - -- Why is it always Segmentation's fault? -----BEGIN PGP SIGNATURE----- Version: 2.6.3i Charset: noconv iQCVAwUBOa1MsQotfkegMgnVAQEIsAP+Na72pNdT+RoQcjuX5cn1TKkPlNAh9BV5 kCNP+Zui6WfZSiA8RYPuruXF0QyEMPZZD6AI9Wqr5sQ75kVSb65uOt9rLrdS0bxA WTClNjlLKG3Rk1IGSFBm+C0p8lcA3AYTohHLhHB3q+WeLTneI5lJfwpo2AWyinQt 0k/1r6EwpUk= =+skX -----END PGP SIGNATURE-----
Mario Weilguni wrote: > -----BEGIN PGP SIGNED MESSAGE----- > > Last week I created a patch for the Postgres client side libraries to allow > something like a (not so mighty) form of Oracle TNS, but nobody showed any > interest. Currently, the patch is not perfect yet, but works fine for us. I > want to avoid improving the patch if there is no interest in it, so if you > think it might be a worthy improvement please drop me a line. > > It works like this: > The patch allows to supply another parameter to the Postgres connect string, > called "service". So, instead of having a connect string (e.g. in PHP) like > "dbname=foo host=bar port=5433 user=foouser password=barpass" > the string would be > "service=stupid_name_here" > or more often > "service=stupid_name_here user=foouser password=barpass" > > There's a config [...] IMHO a good idea. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
Mario Weilguni <mweilguni@sime.com> writes: > Last week I created a patch for the Postgres client side libraries to allow > something like a (not so mighty) form of Oracle TNS, but nobody showed any > interest. Currently, the patch is not perfect yet, but works fine for us. I > want to avoid improving the patch if there is no interest in it, so if you > think it might be a worthy improvement please drop me a line. FWIW, it seemed like a moderately reasonable idea to me. But it troubles me that you didn't get positive responses; as you say, no point in maintaining the feature unless people will use it. Perhaps you should bring it up on pgsql-interfaces, which seems like the most likely place to discuss such a feature. regards, tom lane
> > Last week I created a patch for the Postgres client side libraries to allow > > something like a (not so mighty) form of Oracle TNS, but nobody showed any > > interest. Perhaps it would be helpful to describe TNS: what it does, and what it is good for. You posted your notice out of the blue, and for those of us who didn't take the time to research what the heck you were talking about, there wasn't much point in responding. There are lots of good ideas floating around out there, and it is a shame, but true anyway, that it takes most of us a while to warm up to a new idea or proposal. Thanks for posting a followup message, and it would be good to hear more about your proposal. I'm sure if it is a useful feature that it will be of interest in the long run... Regards. - Thomas
On Wed, Aug 30, 2000 at 08:04:33PM +0200, Mario Weilguni wrote: > > Last week I created a patch for the Postgres client side libraries to allow > something like a (not so mighty) form of Oracle TNS, but nobody showed any > interest. Currently, the patch is not perfect yet, but works fine for us. I > want to avoid improving the patch if there is no interest in it, so if you > think it might be a worthy improvement please drop me a line. > > It works like this: > The patch allows to supply another parameter to the Postgres connect string, > called "service". So, instead of having a connect string (e.g. in PHP) like > "dbname=foo host=bar port=5433 user=foouser password=barpass" > the string would be > "service=stupid_name_here" > or more often > "service=stupid_name_here user=foouser password=barpass" > > There's a config file /etc/pg_service.conf, having an entry like: > [stupid_name_here] > dbname=foo > host=bar > port=5433 > .... > Looks kind of like a server side ODBC datasource. Looks useful to me. I've mainly been using ColdFusion to connect my webpages to postgresql, via ODBC, and I can attest to the utility of just changing the host or dbname in the one source being referenced by all that code. Having it server side, so other interfaces can use the same setup, would be nice. Are any of the parameters from your service overrideable? i.e. can it be used to store defaults, say for username? Ross -- Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005
Sounds like people want it. Can you polish it off, add SGML docs and send it over? > -----BEGIN PGP SIGNED MESSAGE----- > > Last week I created a patch for the Postgres client side libraries to allow > something like a (not so mighty) form of Oracle TNS, but nobody showed any > interest. Currently, the patch is not perfect yet, but works fine for us. I > want to avoid improving the patch if there is no interest in it, so if you > think it might be a worthy improvement please drop me a line. > > It works like this: > The patch allows to supply another parameter to the Postgres connect string, > called "service". So, instead of having a connect string (e.g. in PHP) like > "dbname=foo host=bar port=5433 user=foouser password=barpass" > the string would be > "service=stupid_name_here" > or more often > "service=stupid_name_here user=foouser password=barpass" > > There's a config file /etc/pg_service.conf, having an entry like: > [stupid_name_here] > dbname=foo > host=bar > port=5433 > .... > > The advantage is you can go from one database host, database, port or > whatever without having to touch the scripts or applications. We're currently > in the process of migrating all of our PHP and Python scripts to another from > localhost, port 5433 to another machine, port 5432 and it's not something I > ever want to do again, I'd to change around 100 files and I'm still not sure > if I've missed one. > > The patch is client-side only, around 100 lines, needs no changes to the > backend and is compatible with all applications supplying a connection string > (not using PQsetdblogin) > > - -- > Why is it always Segmentation's fault? > -----BEGIN PGP SIGNATURE----- > Version: 2.6.3i > Charset: noconv > > iQCVAwUBOa1MsQotfkegMgnVAQEIsAP+Na72pNdT+RoQcjuX5cn1TKkPlNAh9BV5 > kCNP+Zui6WfZSiA8RYPuruXF0QyEMPZZD6AI9Wqr5sQ75kVSb65uOt9rLrdS0bxA > WTClNjlLKG3Rk1IGSFBm+C0p8lcA3AYTohHLhHB3q+WeLTneI5lJfwpo2AWyinQt > 0k/1r6EwpUk= > =+skX > -----END PGP SIGNATURE----- > [ Attachment, skipping... ] -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026
yes, i can find this useful valter >From: Bruce Momjian <pgman@candle.pha.pa.us> >To: mweilguni@sime.com >CC: Postgres Hacker Lister <pgsql-hackers@postgresql.org> >Subject: Re: [HACKERS] Patch for TNS services >Date: Tue, 12 Sep 2000 01:13:33 -0400 (EDT) > >Sounds like people want it. Can you polish it off, add SGML docs and >send it over? > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Last week I created a patch for the Postgres client side libraries to >allow > > something like a (not so mighty) form of Oracle TNS, but nobody showed >any > > interest. Currently, the patch is not perfect yet, but works fine for >us. I > > want to avoid improving the patch if there is no interest in it, so if >you > > think it might be a worthy improvement please drop me a line. ............ ............ _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.
Yes, I will try to make it this weekend when I've time. Am Die, 12 Sep 2000 schrieben Sie: > Sounds like people want it. Can you polish it off, add SGML docs and > send it over? > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Last week I created a patch for the Postgres client side libraries to > > allow something like a (not so mighty) form of Oracle TNS, but nobody > > showed any interest. Currently, the patch is not perfect yet, but works > > fine for us. I want to avoid improving the patch if there is no interest > > in it, so if you think it might be a worthy improvement please drop me a > > line. > > > > It works like this: > > The patch allows to supply another parameter to the Postgres connect > > string, called "service". So, instead of having a connect string (e.g. in > > PHP) like "dbname=foo host=bar port=5433 user=foouser password=barpass" > > the string would be > > "service=stupid_name_here" > > or more often > > "service=stupid_name_here user=foouser password=barpass" > > > > There's a config file /etc/pg_service.conf, having an entry like: > > [stupid_name_here] > > dbname=foo > > host=bar > > port=5433 > > .... > > > > The advantage is you can go from one database host, database, port or > > whatever without having to touch the scripts or applications. We're > > currently in the process of migrating all of our PHP and Python scripts > > to another from localhost, port 5433 to another machine, port 5432 and > > it's not something I ever want to do again, I'd to change around 100 > > files and I'm still not sure if I've missed one. > > > > The patch is client-side only, around 100 lines, needs no changes to the > > backend and is compatible with all applications supplying a connection > > string (not using PQsetdblogin) > > > > - -- > > Why is it always Segmentation's fault? > > -----BEGIN PGP SIGNATURE----- > > Version: 2.6.3i > > Charset: noconv > > > > iQCVAwUBOa1MsQotfkegMgnVAQEIsAP+Na72pNdT+RoQcjuX5cn1TKkPlNAh9BV5 > > kCNP+Zui6WfZSiA8RYPuruXF0QyEMPZZD6AI9Wqr5sQ75kVSb65uOt9rLrdS0bxA > > WTClNjlLKG3Rk1IGSFBm+C0p8lcA3AYTohHLhHB3q+WeLTneI5lJfwpo2AWyinQt > > 0k/1r6EwpUk= > > =+skX > > -----END PGP SIGNATURE----- > > [ Attachment, skipping... ]
Am Die, 12 Sep 2000 schrieb Bruce Momjian: > Sounds like people want it. Can you polish it off, add SGML docs and > send it over? I prepared and tested a patch vs. 7.0.2, and it works fine. I've added another option which allows users to have their own service file in ~/.pg_service.conf, which might come handy sometimes. I tried to add SGML docs, but I'm not sure where to add a section. At first I'd say in the user.sgml, but I checked it and I'm not sure if this is the right place. Where shall I add the docs? And I've a second problem here, I'm no native english speaker and my docs should be proofread and corrected before adding it. > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Last week I created a patch for the Postgres client side libraries to > > allow something like a (not so mighty) form of Oracle TNS, but nobody > > showed any interest. Currently, the patch is not perfect yet, but works > > fine for us. I want to avoid improving the patch if there is no interest > > in it, so if you think it might be a worthy improvement please drop me a > > line. > > > > It works like this: > > The patch allows to supply another parameter to the Postgres connect > > string, called "service". So, instead of having a connect string (e.g. in > > PHP) like "dbname=foo host=bar port=5433 user=foouser password=barpass" > > the string would be > > "service=stupid_name_here" > > or more often > > "service=stupid_name_here user=foouser password=barpass" > > > > There's a config file /etc/pg_service.conf, having an entry like: > > [stupid_name_here] > > dbname=foo > > host=bar > > port=5433 > > .... > > > > The advantage is you can go from one database host, database, port or > > whatever without having to touch the scripts or applications. We're > > currently in the process of migrating all of our PHP and Python scripts > > to another from localhost, port 5433 to another machine, port 5432 and > > it's not something I ever want to do again, I'd to change around 100 > > files and I'm still not sure if I've missed one. > > > > The patch is client-side only, around 100 lines, needs no changes to the > > backend and is compatible with all applications supplying a connection > > string (not using PQsetdblogin) > > > > - -- > > Why is it always Segmentation's fault? > > -----BEGIN PGP SIGNATURE----- > > Version: 2.6.3i > > Charset: noconv > > > > iQCVAwUBOa1MsQotfkegMgnVAQEIsAP+Na72pNdT+RoQcjuX5cn1TKkPlNAh9BV5 > > kCNP+Zui6WfZSiA8RYPuruXF0QyEMPZZD6AI9Wqr5sQ75kVSb65uOt9rLrdS0bxA > > WTClNjlLKG3Rk1IGSFBm+C0p8lcA3AYTohHLhHB3q+WeLTneI5lJfwpo2AWyinQt > > 0k/1r6EwpUk= > > =+skX > > -----END PGP SIGNATURE----- > > [ Attachment, skipping... ]
Bruce Momjian writes: > Sounds like people want it. Can you polish it off, add SGML docs and > send it over? > > There's a config file /etc/pg_service.conf, having an entry like: Please check that the final patch uses a file in ${sysconfdir} that was specified at configure time, and not "/etc". Something like src/backend/libpq does for the Kerberos files. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
I've now prepared a polished and clean patch vs. 7.0.2. Who's gonna integrate this patch in the CVS? I've no CVS access. The docs are another problem. I've installed jade and most other SGML stuff here, but "make user.html" fails with errors like : jade:user.sgml:5:55:W: cannot generate system identifier for public text "-//OASIS//DTD Dojade:user.sgml:41:0:E: reference to entity "BOOK" for which no system identifier could be jade:user.sgml:5:0: entity was defined here jade:user.sgml:41:0:E: DTD did not contain element declaration for document type name The patch is included as attachement (159 lines). The patch is included Am Tue, 12 Sep 2000 schrieben Sie: > Sounds like people want it. Can you polish it off, add SGML docs and > send it over? > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Last week I created a patch for the Postgres client side libraries to > > allow something like a (not so mighty) form of Oracle TNS, but nobody > > showed any interest. Currently, the patch is not perfect yet, but works > > fine for us. I want to avoid improving the patch if there is no interest > > in it, so if you think it might be a worthy improvement please drop me a > > line. > > > > It works like this: > > The patch allows to supply another parameter to the Postgres connect > > string, called "service". So, instead of having a connect string (e.g. in > > PHP) like "dbname=foo host=bar port=5433 user=foouser password=barpass" > > the string would be > > "service=stupid_name_here" > > or more often > > "service=stupid_name_here user=foouser password=barpass" > > > > There's a config file /etc/pg_service.conf, having an entry like: > > [stupid_name_here] > > dbname=foo > > host=bar > > port=5433 > > .... > > > > The advantage is you can go from one database host, database, port or > > whatever without having to touch the scripts or applications. We're > > currently in the process of migrating all of our PHP and Python scripts > > to another from localhost, port 5433 to another machine, port 5432 and > > it's not something I ever want to do again, I'd to change around 100 > > files and I'm still not sure if I've missed one. > > > > The patch is client-side only, around 100 lines, needs no changes to the > > backend and is compatible with all applications supplying a connection > > string (not using PQsetdblogin) > > > > - -- > > Why is it always Segmentation's fault? > > -----BEGIN PGP SIGNATURE----- > > Version: 2.6.3i > > Charset: noconv > > > > iQCVAwUBOa1MsQotfkegMgnVAQEIsAP+Na72pNdT+RoQcjuX5cn1TKkPlNAh9BV5 > > kCNP+Zui6WfZSiA8RYPuruXF0QyEMPZZD6AI9Wqr5sQ75kVSb65uOt9rLrdS0bxA > > WTClNjlLKG3Rk1IGSFBm+C0p8lcA3AYTohHLhHB3q+WeLTneI5lJfwpo2AWyinQt > > 0k/1r6EwpUk= > > =+skX > > -----END PGP SIGNATURE----- > > [ Attachment, skipping... ]
Sorry for replying to the fairly old messages, but I just had time to open my pgsql mailbox: I would _love_ if your implementation can also implement TNS-style failover, i.e. having multiple /etc/pg_service.conf entries with same name. When replication is available, this will provide a efficient and transparent failover for clients... One of my projects involves putting all email account information into postgres, which means postgres needs to be highly available. Now, I can take care of replication with triggers and hacks, but client-side solution would really benefit from failover... -alex On Tue, 12 Sep 2000, Bruce Momjian wrote: > Sounds like people want it. Can you polish it off, add SGML docs and > send it over? > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > Last week I created a patch for the Postgres client side libraries to allow > > something like a (not so mighty) form of Oracle TNS, but nobody showed any > > interest. Currently, the patch is not perfect yet, but works fine for us. I > > want to avoid improving the patch if there is no interest in it, so if you > > think it might be a worthy improvement please drop me a line. > > > > It works like this: > > The patch allows to supply another parameter to the Postgres connect string, > > called "service". So, instead of having a connect string (e.g. in PHP) like > > "dbname=foo host=bar port=5433 user=foouser password=barpass" > > the string would be > > "service=stupid_name_here" > > or more often > > "service=stupid_name_here user=foouser password=barpass" > > > > There's a config file /etc/pg_service.conf, having an entry like: > > [stupid_name_here] > > dbname=foo > > host=bar > > port=5433 > > .... > > > > The advantage is you can go from one database host, database, port or > > whatever without having to touch the scripts or applications. We're currently > > in the process of migrating all of our PHP and Python scripts to another from > > localhost, port 5433 to another machine, port 5432 and it's not something I > > ever want to do again, I'd to change around 100 files and I'm still not sure > > if I've missed one. > > > > The patch is client-side only, around 100 lines, needs no changes to the > > backend and is compatible with all applications supplying a connection string > > (not using PQsetdblogin) > > > > - -- > > Why is it always Segmentation's fault? > > -----BEGIN PGP SIGNATURE----- > > Version: 2.6.3i > > Charset: noconv > > > > iQCVAwUBOa1MsQotfkegMgnVAQEIsAP+Na72pNdT+RoQcjuX5cn1TKkPlNAh9BV5 > > kCNP+Zui6WfZSiA8RYPuruXF0QyEMPZZD6AI9Wqr5sQ75kVSb65uOt9rLrdS0bxA > > WTClNjlLKG3Rk1IGSFBm+C0p8lcA3AYTohHLhHB3q+WeLTneI5lJfwpo2AWyinQt > > 0k/1r6EwpUk= > > =+skX > > -----END PGP SIGNATURE----- > > > [ Attachment, skipping... ] > > >
Patch applied. Can you send me the SGML diff? I will merge them in. > I've now prepared a polished and clean patch vs. 7.0.2. Who's gonna integrate > this patch in the CVS? I've no CVS access. > > The docs are another problem. I've installed jade and most other SGML stuff > here, but "make user.html" fails with errors like : > > jade:user.sgml:5:55:W: cannot generate system identifier for public text > "-//OASIS//DTD Dojade:user.sgml:41:0:E: reference to entity "BOOK" for which > no system identifier could be > jade:user.sgml:5:0: entity was defined here > jade:user.sgml:41:0:E: DTD did not contain element declaration for document > type name > > The patch is included as attachement (159 lines). > > > The patch is included > > Am Tue, 12 Sep 2000 schrieben Sie: > > Sounds like people want it. Can you polish it off, add SGML docs and > > send it over? > > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > > > > Last week I created a patch for the Postgres client side libraries to > > > allow something like a (not so mighty) form of Oracle TNS, but nobody > > > showed any interest. Currently, the patch is not perfect yet, but works > > > fine for us. I want to avoid improving the patch if there is no interest > > > in it, so if you think it might be a worthy improvement please drop me a > > > line. > > > > > > It works like this: > > > The patch allows to supply another parameter to the Postgres connect > > > string, called "service". So, instead of having a connect string (e.g. in > > > PHP) like "dbname=foo host=bar port=5433 user=foouser password=barpass" > > > the string would be > > > "service=stupid_name_here" > > > or more often > > > "service=stupid_name_here user=foouser password=barpass" > > > > > > There's a config file /etc/pg_service.conf, having an entry like: > > > [stupid_name_here] > > > dbname=foo > > > host=bar > > > port=5433 > > > .... > > > > > > The advantage is you can go from one database host, database, port or > > > whatever without having to touch the scripts or applications. We're > > > currently in the process of migrating all of our PHP and Python scripts > > > to another from localhost, port 5433 to another machine, port 5432 and > > > it's not something I ever want to do again, I'd to change around 100 > > > files and I'm still not sure if I've missed one. > > > > > > The patch is client-side only, around 100 lines, needs no changes to the > > > backend and is compatible with all applications supplying a connection > > > string (not using PQsetdblogin) > > > > > > - -- > > > Why is it always Segmentation's fault? > > > -----BEGIN PGP SIGNATURE----- > > > Version: 2.6.3i > > > Charset: noconv > > > > > > iQCVAwUBOa1MsQotfkegMgnVAQEIsAP+Na72pNdT+RoQcjuX5cn1TKkPlNAh9BV5 > > > kCNP+Zui6WfZSiA8RYPuruXF0QyEMPZZD6AI9Wqr5sQ75kVSb65uOt9rLrdS0bxA > > > WTClNjlLKG3Rk1IGSFBm+C0p8lcA3AYTohHLhHB3q+WeLTneI5lJfwpo2AWyinQt > > > 0k/1r6EwpUk= > > > =+skX > > > -----END PGP SIGNATURE----- > > > > [ Attachment, skipping... ] > [ Attachment, skipping... ] -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026