Reputation: 2258
On SQlite I could do a query for PRAGMA user_version;
and I could set the version if need be too. Is there anything in postgres that could do the same thing?
I tried select version()
but that gets the literal version of postgres, and not a custom set version.
As an update: I researched commenting on databases. Perhaps this could be solution... commenting docs
Upvotes: 6
Views: 3257
Reputation: 121474
You can set a custom configuration parameter. The parameter name must contain a dot, e.g.:
set my.version to 4;
select current_setting('my.version') as version;
version
---------
4
(1 row)
A parameter defined in this way is local to the current session. If you want to define a default value for the parameter for all sessions you can add it to the configuration file postgresql.conf
(for all databases in the server). Alternatively, it is possible to set the default value for a database in the command:
set my.version to 4;
alter database my_database set my.version from current;
See also:
Upvotes: 6