[prev in list] [next in list] [prev in thread] [next in thread]
List: postgresql-sql
Subject: Re: [SQL] IDENTIFY_SYSTEM
From: bricklen <bricklen () gmail ! com>
Date: 2014-02-05 16:15:48
Message-ID: CAGrpgQ_b8smdAU3sjRrxfTWMtK0EnukQc2LCP71Pd4m=PC26xg () mail ! gmail ! com
[Download RAW message or body]
On Wed, Feb 5, 2014 at 6:51 AM, Glyn Astill <glynastill@yahoo.co.uk> wrote:
> >
> > I don't think so no, but you may have better luck finding someone more
> > knowledgable posting to pgsql-general. You could do it by calling
> > pg_controldata via an untrusted procedural language, not so sure how
> happy
> > I'd be with that myself. E.g. with plperlu:
> >
> > CREATE OR REPLACE FUNCTION get_system_identifier_unsafe(text)
> > RETURNS text AS
> > $BODY$
> > my $rv;
> > my $data;
> > my $pg_controldata_bin = $_[0];
> > my $sysid;
> >
> > $rv = spi_exec_query('SHOW data_directory', 1);
> > $data = $rv->{rows}[0]->{data_directory};
> >
> > open(FD,"$pg_controldata_bin $data | ");
> >
> > while(<FD>) {
> > if (/Database system identifier:/) {
> > $sysid = $_;
> > for ($sysid) {
> > s/Database system identifier://;
> > s/[^0-9]//g;
> > }
> > last;
> > }
> > }
> > close (FD);
> > return $sysid;
> >
> > $BODY$
> > LANGUAGE plperlu;
> >
> >
>
> So if I actually ran that:
>
> test=# select get_system_identifier_unsafe('pg_controldata');
> get_system_identifier_unsafe
> ------------------------------
> 5667443312440565226
>
Joe Conway wrote something a few years ago which could probably be brought
up to date and made into a Postgresql extension.
https://github.com/jconway/pg_controldata
[Attachment #3 (text/html)]
<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 5, \
2014 at 6:51 AM, Glyn Astill <span dir="ltr"><<a \
href="mailto:glynastill@yahoo.co.uk" \
target="_blank">glynastill@yahoo.co.uk</a>></span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div><div class="h5"> ><br>
> I don't think so no, but you may have better luck finding someone more<br>
> knowledgable posting to pgsql-general. You could do it by calling<br>
> pg_controldata via an untrusted procedural language, not so sure how happy<br>
> I'd be with that myself. E.g. with plperlu:<br>
><br>
> CREATE OR REPLACE FUNCTION get_system_identifier_unsafe(text)<br>
> RETURNS text AS<br>
> $BODY$<br>
> my $rv;<br>
> my $data;<br>
> my $pg_controldata_bin = $_[0];<br>
> my $sysid;<br>
> <br>
> $rv = spi_exec_query('SHOW data_directory', 1);<br>
> $data = $rv->{rows}[0]->{data_directory};<br>
> <br>
> open(FD,"$pg_controldata_bin $data | ");<br>
> <br>
> while(<FD>) {<br>
> if (/Database system identifier:/) {<br>
> $sysid = $_;<br>
> for ($sysid) {<br>
> s/Database system identifier://;<br>
> s/[^0-9]//g;<br>
> }<br>
> last;<br>
> }<br>
> }<br>
> close (FD);<br>
> return $sysid; <br>
><br>
> $BODY$<br>
> LANGUAGE plperlu;<br>
><br>
><br>
<br>
</div></div>So if I actually ran that:<br>
<br>
test=# select get_system_identifier_unsafe('pg_controldata');<br>
get_system_identifier_unsafe<br>
------------------------------<br>
5667443312440565226<br></blockquote></div><br><br></div><div \
class="gmail_extra">Joe Conway wrote something a few years ago which could probably \
be brought up to date and made into a Postgresql extension. <a \
href="https://github.com/jconway/pg_controldata">https://github.com/jconway/pg_controldata</a><br>
</div></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic