Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> How about the following though the result is different from
> datlastsysoid ?
> select max(oid) from pg_database where datname like 'template%';
Too lax --- suppose someone makes a database named 'template3' ?
Even if we restricted the pattern to 'template[01]', it would fail
if someone deleted and rebuilt template1, which is a supported operation
now.
If we want to do it in a backwards-compatible fashion in pgaccess,
I'd recommend trying the datlastsysoid approach and then the other
way if that fails. I'm just wondering if anyone cares ...
regards, tom lane