Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WB3mt-0006LE-0P for pgsql-sql@arkaria.postgresql.org; Wed, 05 Feb 2014 14:49:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WB3ms-0003tZ-CM for pgsql-sql@arkaria.postgresql.org; Wed, 05 Feb 2014 14:49:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WB3mq-0003rh-NQ for pgsql-sql@postgresql.org; Wed, 05 Feb 2014 14:49:12 +0000 Received: from nm32-vm6.bullet.mail.ir2.yahoo.com ([212.82.97.102]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WB3mi-0002Xt-M5 for pgsql-sql@postgresql.org; Wed, 05 Feb 2014 14:49:12 +0000 Received: from [212.82.98.52] by nm32.bullet.mail.ir2.yahoo.com with NNFMP; 05 Feb 2014 14:49:02 -0000 Received: from [212.82.98.99] by tm5.bullet.mail.ir2.yahoo.com with NNFMP; 05 Feb 2014 14:49:02 -0000 Received: from [127.0.0.1] by omp1036.mail.ir2.yahoo.com with NNFMP; 05 Feb 2014 14:49:02 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 82806.12831.bm@omp1036.mail.ir2.yahoo.com Received: (qmail 24165 invoked by uid 60001); 5 Feb 2014 14:45:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1391611541; bh=rg1C5P1z3uiWXIc23AUZLE2gMBaBpHkpXgIVLQrqRwQ=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=SSN7/772LmkjrueqNNKUpPpP6jYwG2n6cA5qE+Q/Zx54qt5IqXDjhC4+t20sSzQtXLsGYKFWbw/EbX0bs8lRVG5yEcaEBrzErR10Hu9cLYXutLYfnZICjyOP4i13TnGKol9CITunT/bpV+dYy98veO7VmUIDXzdtkxCACDJSgwU= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ukSaan8ZMJt8VccKDDgUSzmODwoanEM9N6g4HPbHiU4B5B109vRyI9TvZwjieyaEYoW0kEJCuWnN4F4RAtHMcwzQjg/szmASWAg/vdcjofUK9il38WRaJs1gtGD/MuqEsfOGqiWIyqhEZvJlInpBfHpWxc70A8nF4ewzDUFy8Ks=; X-YMail-OSG: DbXUcB0VM1kHIKXQ01nPXkHt34f2AZvvs8C.YERJ3suvt3q h9flX4llFNRM5Y1WXUgnrx.RBbPPctrAyzFOWYkc3ArGymyaVszOrypPkb1u Y_daU8VGCzg6LbjAvi7WIPBUsOJFgjLBYrJ_M1Viqrk2PWC9nDoJrvCyGaIt TNb_lXzybAHeUm0sNwECbaR7WuybnANLv_WF_96YtwLf.oUjInAgOucY52d. tdwmzzQSrk651mGTHaYaWGRTmlc9pMk8oJZRqc_j69QFDPwb_LIhJ7KwODGN iQ1ry.707vjNDaGipkpVx8LLgqhVhvVMGpMCfM2Qsi2N76wbK9WW0guOZiOE FLwy0t6N1_sKfrdfbA.LOI_98q6J0vK4gxbCQ7pvcMoeJy9b1poG7GEEKgks CtBTfhwWLDdMDk05kttT2i5C2YSuMXSL8YjCR45RCIsQaGcroppHjkQPhwka FhXLjVbK5InJRvTTs0BJQj_ZU6o2fEWd6AYHOqoHtKTRcHBoaGdGcrMWyycQ 9nkSpGCzecUNmXMcMyBoWkKzYkaay0Nypl1VVecbRB27DnKcWaHficGEMlbl 4 Received: from [194.168.202.210] by web133205.mail.ir2.yahoo.com via HTTP; Wed, 05 Feb 2014 14:45:41 GMT X-Rocket-MIMEInfo: 002.001, LS0tLS0gT3JpZ2luYWwgTWVzc2FnZSAtLS0tLQoKPiBGcm9tOiBDZXphcml1c3ogTWFyZWsgPGNlemFyaXVzei5tYXJla0Bjb21hcmNoLnBsPgo.IFRvOiBwZ3NxbC1zcWxAcG9zdGdyZXNxbC5vcmcKPiBDYzogCj4gU2VudDogV2VkbmVzZGF5LCA1IEZlYnJ1YXJ5IDIwMTQsIDEyOjAxCj4gU3ViamVjdDogUmU6IFtTUUxdIElERU5USUZZX1NZU1RFTQo.IAo.PiAgVGhhdCdzIHBhcnQgb2YgdGhlIHN0cmVhbWluZyByZXBsaWNhdGlvbiBwcm90b2NvbAo.PiAKPj4gIGh0dHA6Ly93d3cucG9zdGdyZXNxbC5vcmcBMAEBAQE- X-Mailer: YahooMailWebService/0.8.175.631 References: <08af01cf20ba$d5f0aec0$81d20c40$@comarch.pl> <1391600088.5800.YahooMailNeo@web133204.mail.ir2.yahoo.com> <0aa401cf226a$12eb9320$38c2b960$@comarch.pl> Message-ID: <1391611541.96644.YahooMailNeo@web133205.mail.ir2.yahoo.com> Date: Wed, 5 Feb 2014 14:45:41 +0000 (GMT) From: Glyn Astill Reply-To: Glyn Astill Subject: Re: IDENTIFY_SYSTEM To: Cezariusz Marek , "pgsql-sql@postgresql.org" In-Reply-To: <0aa401cf226a$12eb9320$38c2b960$@comarch.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org ----- Original Message ----- > From: Cezariusz Marek > To: pgsql-sql@postgresql.org > Cc:=20 > Sent: Wednesday, 5 February 2014, 12:01 > Subject: Re: [SQL] IDENTIFY_SYSTEM >=20 >> That's part of the streaming replication protocol >>=20 >> http://www.postgresql.org/docs/9.3/static/protocol-replication.html >> As long as you're using wal_level >=3D archive and the replication=20 > connection is enabled you can retrieve it via psql >=20 > Yes, I know, but there is no way to get the systemid value from a functio= n using=20 > just SQL or plpgsql? >=20 I don't think so no, but you may have better luck finding someone more know= ledgable posting to pgsql-general.=A0 You could do it by calling pg_control= data via an untrusted procedural language, not so sure how happy I'd be wit= h that myself.=A0 E.g. with plperlu: CREATE OR REPLACE FUNCTION get_system_identifier_unsafe(text)=20 RETURNS text AS=20 $BODY$ =A0=A0=A0 my $rv; =A0=A0=A0 my $data; =A0=A0=A0 my $pg_controldata_bin =3D $_[0]; =A0=A0=A0 my $sysid; =A0=A0=A0=20 =A0=A0=A0 $rv =3D spi_exec_query('SHOW data_directory', 1); =A0=A0=A0 $data =3D $rv->{rows}[0]->{data_directory}; =A0=A0=A0=20 =A0=A0=A0 open(FD,"$pg_controldata_bin $data | "); =A0=A0=A0=20 =A0=A0=A0 while() { =A0=A0=A0 =A0=A0=A0 if (/Database system identifier:/) { =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 $sysid =3D $_; =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 for ($sysid) { =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 s/Database system identifier://; =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 s/[^0-9]//g; =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 } =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 last; =A0=A0=A0 =A0=A0=A0 } =A0=A0=A0 } =A0=A0=A0 close (FD); =A0=A0=A0 return $sysid;=A0=A0=A0=20 $BODY$ LANGUAGE plperlu; >> If it's just for licencing perhaps inet_server_addr() or a plperl=20 > function to grab the mac address of the machine might suffice? >=20 > I have to license each database, not just the whole machine. And the syst= emid is=20 > the only unique database identifier I've found. Is it each database or each postgresql instance / cluster?=A0=A0 How exactl= y do you want your licencing to work? There may be a better way. --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql