Regarding these prior threads:<br /><br /><a href="http://www.postgresql.org/message-id/CAC2SuRJLMtKyvCs6DbxdyUrHy+WKe-94cBuGnwCXAg914cwG7g@mail.gmail.com">http://www.postgresql.org/message-id/CAC2SuRJLMtKyvCs6DbxdyUrHy+WKe-94cBuGnwCXAg914cwG7g@mail.gmail.com</a><br /><a href="http://www.postgresql.org/message-id/200707101624.47885.peter_e@gmx.net">http://www.postgresql.org/message-id/200707101624.47885.peter_e@gmx.net</a><br /><br/> It's somewhat less than pretty, but you *can* simply:<br /><br /><br /> select substring(pg_read_binary_file('global/pg_control'),1,8);<br /><br /> then, knowing whether the system is little- or big-endian,decode the resulting hex representation of a uint64 however you find to be convenient, like say:<br /><br /><br/> #!/usr/bin/python <br /> import struct <br /> import sys<br /> print struct.unpack("Q", sys.argv[1].decode("hex"))[0]<br/><br /><br /> ... or your preferred spelling in C/Perl/LOLCode/whatever.<br /><br /> Formany purposes the raw hex representation will be sufficient in any case.<br /><br /> The main downside here is the requirementof a superuser connection.<br /><br /> It'd be fairly trivial (and a lot saner) to write an extension to exposeGetSystemIdentifier() via SQL. Unfortunately that won't work for my purposes because I need something that'll workon potentially quite old servers and with minimal intrusiveness, but it'd be a reasonable answer for people who wantit for cluster/replication management.<br /><br /><pre class="moz-signature" cols="72">-- Craig Ringer <a class="moz-txt-link-freetext" href="http://www.2ndQuadrant.com/">http://www.2ndQuadrant.com/</a>PostgreSQL Development,24x7 Support, Training & Services</pre>
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных