Re: dblink_get_connections() result for no connections

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: dblink_get_connections() result for no connections
Date: 2014-11-27 03:20:12
Message-ID: 5476986C.4000901@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/25/2014 12:49 PM, Tom Lane wrote:
> While fooling around with the array_agg(anyarray) patch, I noted
> that dblink_get_connections() returns NULL if there are no active
> connections. It seems like an empty array might be a saner
> definition --- thoughts?

(Sorry for the slow response -- was traveling all day yesterday)

The original patch introducing this function is seen here:

http://www.postgresql.org/message-id/44C50F4A.7050708@joeconway.com

and committed by me here:

http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=52a3ed9fac32e16f6061cbc49046c0bd97f8f77a

In particular, the original author said:
8<-------------------------
Added functions:
[...]
dblink_get_connections()
List all open dblink connections by name.
Returns a comma separated string of all connection names.
Takes no params

Example: SELECT string_to_array(dblink_get_connections(), ',');
8<-------------------------

He really did not specify what the return value should be if there are
no connections. Somewhere between submission and commit I changed that
to return an array rather than comma separated string.

To be honest I have no idea why I did not make it an empty array
instead of a NULL in that case, but that does make more sense to me
now that you mention it. Might cause some breakage for people
depending on that though...

Joe

- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUdphsAAoJEDfy90M199hlXuUP/i72+AKHdDS18gjHv7/axvS1
/6v0KMK9GvQBbfaHHlQ22eoCBkX6eZI3XW7FYymD4oDYBEK3rihck6sjBxFokrK7
QSYWiSX0tgeAvE99WCI3aLxyXZDTxnlaobfTwg1OMUsz2a8O23fppDrevYe+4EDC
t40dpiJiG/6r7wektARSJQG0DtINaEeRwvGVBhMExvGo+76GNfotqTaRLex0Fugi
8FoE7VP61Kx9P7wMV/QOB3VK+apfPVEd4jN6lsSYp0MDKI64dk6ITfxng9KTMbUi
wP+01WK7oljJeUBQRM1Co/OBXcAUTWXhr6wwwZgUqw1eeMU7rXLuDDtIz4B2NEFY
tp6mFuAb15x+BmdBjJSYTz/ckG7n+NEJ4VyiK/gQWe3+WUajRqAPh38xpiWniTL4
l7cajIAWy5kO7RKXyaFxmRqXI148lUO2DosF/uL0nbOrCYjdf9VSGnDzq9bST2BE
mz7i7l5Ej/Pt1OPu4oeKRyEo39GkyD/2fsstVv66403LYaEWwyyKUA2rg1W1T2aN
WALXUgCmpEVstTtHJFS6cvGy4dw4QobUihJWOZEOtesF7XIxQcXLttTUrydPBfVC
6zOZIoVcKO1O2ER0nFBmSVVo+63Y4rgK8WLnJJ2C7WcFvC0Kd5BfzQ1BSMoPeCA2
2KhIlr2QbyeUeY6Ebz+o
=vNw9
-----END PGP SIGNATURE-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2014-11-27 03:22:32 Re: Add shutdown_at_recovery_target option to recovery.conf
Previous Message Michael Paquier 2014-11-27 02:30:15 Re: Add shutdown_at_recovery_target option to recovery.conf