How to fix the version reported by psql?
I have been working on an Ansible script for defining the standard template of our corporate servers. For some historical reasons, we chose to stick with PostgreSQL 9.6 even though we're using Ubuntu 18.04, which comes with PostgreSQL 11. We intend to catch up with the latest version after a transition phase of some months.
The 18.04 image we use from AWS has PG 11. After uninstalling version 11 and installing 9.6 on our test server, the result of psql --version
is still:
psql (PostgreSQL) 11.1 (Ubuntu 11.1-3.pgdg18.04+1)
However, apt-cache policy postgresql-11
gives me:
postgresql-11:
Installed: (none)
Candidate: 11.1-3.pgdg18.04+1
Version table:
11.1-3.pgdg18.04+1 500
500 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages
pg_lsclusters
yields:
Ver Cluster Port Status Owner Data directory Log file
9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
I find all that misleading, even in the light of the fact that psql
will talk to the server listening on 5432. I'd rather leave things in a consistent and explicit state, and not run the risk of some compatibility problems in our scripts.
My question is: is it possible to fix the version reported by psql so that it can report a version that is actually present?
I feel like the removal of version 11 left some remnants which appear unwanted to me, despite of the task specifying purge and autoremove.
[EDIT 2019-02-10]
The comment by @steeldriver put me on the right track. My Ansible role was installing postgresql-9.6
and postgresql-contrib
, which didn't make sense because as I understood it, without the specification of 9.6
as the version, postgresql-contrib
would stand for its current most up-to-date package, which is postgresql-contrib-11
, which in turn has postgresql-11
as a dependency.
I ended up with versions 9.6 and 11, and erroneously thought that the Amazon image had postgresql-11 in it. I was wrong.
When I removed postgresql-11
(with autoremove) the uninstallation still left behind the /var/lib/postgresql/11/bin
folder, where a psql
binary remained. The wrapper that launches PostgreSQL binaries enumerates the versions in /var/lib/postgresql
and for each, checks whether the psql
binary is on the filesystem. If it is, then the most recent version is used.
With the comments and answers, I now understand that this is certainly because the package to remove was a flavor of postgresql-client-common
and not just postgresql-11
.
postgresql
add a comment |
I have been working on an Ansible script for defining the standard template of our corporate servers. For some historical reasons, we chose to stick with PostgreSQL 9.6 even though we're using Ubuntu 18.04, which comes with PostgreSQL 11. We intend to catch up with the latest version after a transition phase of some months.
The 18.04 image we use from AWS has PG 11. After uninstalling version 11 and installing 9.6 on our test server, the result of psql --version
is still:
psql (PostgreSQL) 11.1 (Ubuntu 11.1-3.pgdg18.04+1)
However, apt-cache policy postgresql-11
gives me:
postgresql-11:
Installed: (none)
Candidate: 11.1-3.pgdg18.04+1
Version table:
11.1-3.pgdg18.04+1 500
500 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages
pg_lsclusters
yields:
Ver Cluster Port Status Owner Data directory Log file
9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
I find all that misleading, even in the light of the fact that psql
will talk to the server listening on 5432. I'd rather leave things in a consistent and explicit state, and not run the risk of some compatibility problems in our scripts.
My question is: is it possible to fix the version reported by psql so that it can report a version that is actually present?
I feel like the removal of version 11 left some remnants which appear unwanted to me, despite of the task specifying purge and autoremove.
[EDIT 2019-02-10]
The comment by @steeldriver put me on the right track. My Ansible role was installing postgresql-9.6
and postgresql-contrib
, which didn't make sense because as I understood it, without the specification of 9.6
as the version, postgresql-contrib
would stand for its current most up-to-date package, which is postgresql-contrib-11
, which in turn has postgresql-11
as a dependency.
I ended up with versions 9.6 and 11, and erroneously thought that the Amazon image had postgresql-11 in it. I was wrong.
When I removed postgresql-11
(with autoremove) the uninstallation still left behind the /var/lib/postgresql/11/bin
folder, where a psql
binary remained. The wrapper that launches PostgreSQL binaries enumerates the versions in /var/lib/postgresql
and for each, checks whether the psql
binary is on the filesystem. If it is, then the most recent version is used.
With the comments and answers, I now understand that this is certainly because the package to remove was a flavor of postgresql-client-common
and not just postgresql-11
.
postgresql
2
What packages did you uninstall / replace exactly? AFAIK thepsql
binary would be part of the client package (e.g.postgresql-client-11
)
– steeldriver
Feb 6 at 13:53
add a comment |
I have been working on an Ansible script for defining the standard template of our corporate servers. For some historical reasons, we chose to stick with PostgreSQL 9.6 even though we're using Ubuntu 18.04, which comes with PostgreSQL 11. We intend to catch up with the latest version after a transition phase of some months.
The 18.04 image we use from AWS has PG 11. After uninstalling version 11 and installing 9.6 on our test server, the result of psql --version
is still:
psql (PostgreSQL) 11.1 (Ubuntu 11.1-3.pgdg18.04+1)
However, apt-cache policy postgresql-11
gives me:
postgresql-11:
Installed: (none)
Candidate: 11.1-3.pgdg18.04+1
Version table:
11.1-3.pgdg18.04+1 500
500 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages
pg_lsclusters
yields:
Ver Cluster Port Status Owner Data directory Log file
9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
I find all that misleading, even in the light of the fact that psql
will talk to the server listening on 5432. I'd rather leave things in a consistent and explicit state, and not run the risk of some compatibility problems in our scripts.
My question is: is it possible to fix the version reported by psql so that it can report a version that is actually present?
I feel like the removal of version 11 left some remnants which appear unwanted to me, despite of the task specifying purge and autoremove.
[EDIT 2019-02-10]
The comment by @steeldriver put me on the right track. My Ansible role was installing postgresql-9.6
and postgresql-contrib
, which didn't make sense because as I understood it, without the specification of 9.6
as the version, postgresql-contrib
would stand for its current most up-to-date package, which is postgresql-contrib-11
, which in turn has postgresql-11
as a dependency.
I ended up with versions 9.6 and 11, and erroneously thought that the Amazon image had postgresql-11 in it. I was wrong.
When I removed postgresql-11
(with autoremove) the uninstallation still left behind the /var/lib/postgresql/11/bin
folder, where a psql
binary remained. The wrapper that launches PostgreSQL binaries enumerates the versions in /var/lib/postgresql
and for each, checks whether the psql
binary is on the filesystem. If it is, then the most recent version is used.
With the comments and answers, I now understand that this is certainly because the package to remove was a flavor of postgresql-client-common
and not just postgresql-11
.
postgresql
I have been working on an Ansible script for defining the standard template of our corporate servers. For some historical reasons, we chose to stick with PostgreSQL 9.6 even though we're using Ubuntu 18.04, which comes with PostgreSQL 11. We intend to catch up with the latest version after a transition phase of some months.
The 18.04 image we use from AWS has PG 11. After uninstalling version 11 and installing 9.6 on our test server, the result of psql --version
is still:
psql (PostgreSQL) 11.1 (Ubuntu 11.1-3.pgdg18.04+1)
However, apt-cache policy postgresql-11
gives me:
postgresql-11:
Installed: (none)
Candidate: 11.1-3.pgdg18.04+1
Version table:
11.1-3.pgdg18.04+1 500
500 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages
pg_lsclusters
yields:
Ver Cluster Port Status Owner Data directory Log file
9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
I find all that misleading, even in the light of the fact that psql
will talk to the server listening on 5432. I'd rather leave things in a consistent and explicit state, and not run the risk of some compatibility problems in our scripts.
My question is: is it possible to fix the version reported by psql so that it can report a version that is actually present?
I feel like the removal of version 11 left some remnants which appear unwanted to me, despite of the task specifying purge and autoremove.
[EDIT 2019-02-10]
The comment by @steeldriver put me on the right track. My Ansible role was installing postgresql-9.6
and postgresql-contrib
, which didn't make sense because as I understood it, without the specification of 9.6
as the version, postgresql-contrib
would stand for its current most up-to-date package, which is postgresql-contrib-11
, which in turn has postgresql-11
as a dependency.
I ended up with versions 9.6 and 11, and erroneously thought that the Amazon image had postgresql-11 in it. I was wrong.
When I removed postgresql-11
(with autoremove) the uninstallation still left behind the /var/lib/postgresql/11/bin
folder, where a psql
binary remained. The wrapper that launches PostgreSQL binaries enumerates the versions in /var/lib/postgresql
and for each, checks whether the psql
binary is on the filesystem. If it is, then the most recent version is used.
With the comments and answers, I now understand that this is certainly because the package to remove was a flavor of postgresql-client-common
and not just postgresql-11
.
postgresql
postgresql
edited Feb 10 at 1:52
AbVog
asked Feb 6 at 13:31
AbVogAbVog
1085
1085
2
What packages did you uninstall / replace exactly? AFAIK thepsql
binary would be part of the client package (e.g.postgresql-client-11
)
– steeldriver
Feb 6 at 13:53
add a comment |
2
What packages did you uninstall / replace exactly? AFAIK thepsql
binary would be part of the client package (e.g.postgresql-client-11
)
– steeldriver
Feb 6 at 13:53
2
2
What packages did you uninstall / replace exactly? AFAIK the
psql
binary would be part of the client package (e.g. postgresql-client-11
)– steeldriver
Feb 6 at 13:53
What packages did you uninstall / replace exactly? AFAIK the
psql
binary would be part of the client package (e.g. postgresql-client-11
)– steeldriver
Feb 6 at 13:53
add a comment |
1 Answer
1
active
oldest
votes
The comment here is completely and totally accurate. You can easily confirm this by utilizing the sadly underused Ubuntu Package Search which for 18.04 reports that psql is part of postgresql-client-common
psql
is reporting the version of psql installed as expected.
If you want to see the version of a package that you have installed dpkg -l packagename
is useful.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116101%2fhow-to-fix-the-version-reported-by-psql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The comment here is completely and totally accurate. You can easily confirm this by utilizing the sadly underused Ubuntu Package Search which for 18.04 reports that psql is part of postgresql-client-common
psql
is reporting the version of psql installed as expected.
If you want to see the version of a package that you have installed dpkg -l packagename
is useful.
add a comment |
The comment here is completely and totally accurate. You can easily confirm this by utilizing the sadly underused Ubuntu Package Search which for 18.04 reports that psql is part of postgresql-client-common
psql
is reporting the version of psql installed as expected.
If you want to see the version of a package that you have installed dpkg -l packagename
is useful.
add a comment |
The comment here is completely and totally accurate. You can easily confirm this by utilizing the sadly underused Ubuntu Package Search which for 18.04 reports that psql is part of postgresql-client-common
psql
is reporting the version of psql installed as expected.
If you want to see the version of a package that you have installed dpkg -l packagename
is useful.
The comment here is completely and totally accurate. You can easily confirm this by utilizing the sadly underused Ubuntu Package Search which for 18.04 reports that psql is part of postgresql-client-common
psql
is reporting the version of psql installed as expected.
If you want to see the version of a package that you have installed dpkg -l packagename
is useful.
answered Feb 6 at 14:16
Elder GeekElder Geek
27.5k1055130
27.5k1055130
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116101%2fhow-to-fix-the-version-reported-by-psql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
What packages did you uninstall / replace exactly? AFAIK the
psql
binary would be part of the client package (e.g.postgresql-client-11
)– steeldriver
Feb 6 at 13:53