Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb035cb9

Browse files
committed
Accept postgres:// URIs in libpq connection functions
postgres:// URIs are an attempt to "stop the bleeding" in this generalarea that has been said to occur due to external projects adopting theirown syntaxes. The syntaxes supported by this patch: postgres://[user[:pwd]@][unix-socket][:port[/dbname]][?param1=value1&...] postgres://[user[:pwd]@][net-location][:port][/dbname][?param1=value1&...]should be enough to cover most interesting cases without having toresort to "param=value" pairs, but those are provided for the cases thatneed them regardless.libpq documentation has been shuffled around a bit, to avoid stuffingall the format details into the PQconnectdbParams description, which wasalready a bit overwhelming. The list of keywords has moved to its ownsubsection, and the details on the URI format live in another subsection.This includes a simple test program, as requested in discussion, toensure that interesting corner cases continue to work appropriately inthe future.Author: Alexander ShulginSome tweaking by Álvaro Herrera, Greg Smith, Daniel Farina, Peter EisentrautReviewed by Robert Haas, Alexey Klyukin (offlist), Heikki Linnakangas,Marko Kreen, and othersOh, it also supports postgresql:// but that's probably just an accident.
1 parent3769fa5 commitb035cb9

File tree

10 files changed

+1714
-605
lines changed

10 files changed

+1714
-605
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 633 additions & 531 deletions
Large diffs are not rendered by default.

‎doc/src/sgml/ref/psql-ref.sgml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ PostgreSQL documentation
115115
argument on the command line.
116116
</para>
117117
<para>
118-
If this parameter contains an <symbol>=</symbol> sign, it is treated as a
118+
If this parameter contains an <symbol>=</symbol> sign or starts
119+
with a valid <acronym>URI</acronym> prefix
120+
(<literal>postgresql://</literal>
121+
or <literal>postgres://</literal>), it is treated as a
119122
<parameter>conninfo</parameter> string. See <xref linkend="libpq-connect"> for more information.
120123
</para>
121124
</listitem>
@@ -596,11 +599,13 @@ PostgreSQL documentation
596599

597600
<para>
598601
An alternative way to specify connection parameters is in a
599-
<parameter>conninfo</parameter> string, which is used instead of a
600-
database name. This mechanism give you very wide control over the
602+
<parameter>conninfo</parameter> string or
603+
a <acronym>URI</acronym>, which is used instead of a database
604+
name. This mechanism give you very wide control over the
601605
connection. For example:
602606
<programlisting>
603607
$ <userinput>psql "service=myservice sslmode=require"</userinput>
608+
$ <userinput>psql postgresql://dbmaster:5433/mydb?sslmode=require</userinput>
604609
</programlisting>
605610
This way you can also use LDAP for connection parameter lookup as
606611
described in <xref linkend="libpq-ldap">.

‎src/interfaces/libpq/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ install: all installdirs install-lib
121121
$(INSTALL_DATA)$(srcdir)/pqexpbuffer.h'$(DESTDIR)$(includedir_internal)'
122122
$(INSTALL_DATA)$(srcdir)/pg_service.conf.sample'$(DESTDIR)$(datadir)/pg_service.conf.sample'
123123

124+
installcheck:
125+
$(MAKE) -Ctest$@
126+
124127
installdirs: installdirs-lib
125128
$(MKDIR_P)'$(DESTDIR)$(includedir)''$(DESTDIR)$(includedir_internal)'
126129

@@ -132,6 +135,7 @@ uninstall: uninstall-lib
132135
rm -f'$(DESTDIR)$(datadir)/pg_service.conf.sample'
133136

134137
cleandistclean: clean-lib
138+
$(MAKE) -Ctest$@
135139
rm -f$(OBJS) pthread.h libpq.rc
136140
# Might be left over from a Win32 client-only build
137141
rm -f pg_config_paths.h
@@ -142,4 +146,5 @@ clean distclean: clean-lib
142146
rm -f encnames.c wchar.c
143147

144148
maintainer-clean: distclean maintainer-clean-lib
149+
$(MAKE) -Ctest$@
145150
rm -f libpq-dist.rc

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp