Postgresql: delete all comments from database
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a database for which the comments on objects (PSQL command COMMENT) are just pollution for us: they are obsolete and in a language that no one reads in our organisation. Hence, I'd like to delete all these comments at once. There are hundreds of them and I don't want to write hundreds of command lines "COMMENT ON xxx IS NULL".
Anybody knows how to do this ?
postgresql
add a comment |
I have a database for which the comments on objects (PSQL command COMMENT) are just pollution for us: they are obsolete and in a language that no one reads in our organisation. Hence, I'd like to delete all these comments at once. There are hundreds of them and I don't want to write hundreds of command lines "COMMENT ON xxx IS NULL".
Anybody knows how to do this ?
postgresql
You have not accepted an answer to any of your questions, yet. Please read meta.stackexchange.com/questions/5234/… and be more cooperative.
– Erwin Brandstetter
Jan 25 at 1:17
add a comment |
I have a database for which the comments on objects (PSQL command COMMENT) are just pollution for us: they are obsolete and in a language that no one reads in our organisation. Hence, I'd like to delete all these comments at once. There are hundreds of them and I don't want to write hundreds of command lines "COMMENT ON xxx IS NULL".
Anybody knows how to do this ?
postgresql
I have a database for which the comments on objects (PSQL command COMMENT) are just pollution for us: they are obsolete and in a language that no one reads in our organisation. Hence, I'd like to delete all these comments at once. There are hundreds of them and I don't want to write hundreds of command lines "COMMENT ON xxx IS NULL".
Anybody knows how to do this ?
postgresql
postgresql
asked Dec 21 '18 at 20:14
Darth KangoorooDarth Kangooroo
566
566
You have not accepted an answer to any of your questions, yet. Please read meta.stackexchange.com/questions/5234/… and be more cooperative.
– Erwin Brandstetter
Jan 25 at 1:17
add a comment |
You have not accepted an answer to any of your questions, yet. Please read meta.stackexchange.com/questions/5234/… and be more cooperative.
– Erwin Brandstetter
Jan 25 at 1:17
You have not accepted an answer to any of your questions, yet. Please read meta.stackexchange.com/questions/5234/… and be more cooperative.
– Erwin Brandstetter
Jan 25 at 1:17
You have not accepted an answer to any of your questions, yet. Please read meta.stackexchange.com/questions/5234/… and be more cooperative.
– Erwin Brandstetter
Jan 25 at 1:17
add a comment |
1 Answer
1
active
oldest
votes
Erwin Brandstetter gave a very good answer on how to do this on this question Removing COMMENT ON from all objects in PostgreSQL on Stack Overflow.
It basically consists of removing the comments directly from the system catalogues like so (disclaimer - the following code is copied directly from his answer):
DELETE FROM pg_description WHERE description = 'something special';
Or you could delete the comments based on any other criteria you may choose.
1
@Darth Kangooroo, in addition, you should also check out PhilHibbs answer in the same thread. He uses the information_schema to generateCOMMENT
statements.
– Lennart
Dec 21 '18 at 20:44
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2fdba.stackexchange.com%2fquestions%2f225589%2fpostgresql-delete-all-comments-from-database%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
Erwin Brandstetter gave a very good answer on how to do this on this question Removing COMMENT ON from all objects in PostgreSQL on Stack Overflow.
It basically consists of removing the comments directly from the system catalogues like so (disclaimer - the following code is copied directly from his answer):
DELETE FROM pg_description WHERE description = 'something special';
Or you could delete the comments based on any other criteria you may choose.
1
@Darth Kangooroo, in addition, you should also check out PhilHibbs answer in the same thread. He uses the information_schema to generateCOMMENT
statements.
– Lennart
Dec 21 '18 at 20:44
add a comment |
Erwin Brandstetter gave a very good answer on how to do this on this question Removing COMMENT ON from all objects in PostgreSQL on Stack Overflow.
It basically consists of removing the comments directly from the system catalogues like so (disclaimer - the following code is copied directly from his answer):
DELETE FROM pg_description WHERE description = 'something special';
Or you could delete the comments based on any other criteria you may choose.
1
@Darth Kangooroo, in addition, you should also check out PhilHibbs answer in the same thread. He uses the information_schema to generateCOMMENT
statements.
– Lennart
Dec 21 '18 at 20:44
add a comment |
Erwin Brandstetter gave a very good answer on how to do this on this question Removing COMMENT ON from all objects in PostgreSQL on Stack Overflow.
It basically consists of removing the comments directly from the system catalogues like so (disclaimer - the following code is copied directly from his answer):
DELETE FROM pg_description WHERE description = 'something special';
Or you could delete the comments based on any other criteria you may choose.
Erwin Brandstetter gave a very good answer on how to do this on this question Removing COMMENT ON from all objects in PostgreSQL on Stack Overflow.
It basically consists of removing the comments directly from the system catalogues like so (disclaimer - the following code is copied directly from his answer):
DELETE FROM pg_description WHERE description = 'something special';
Or you could delete the comments based on any other criteria you may choose.
answered Dec 21 '18 at 20:22
Mr.BrownstoneMr.Brownstone
10.1k32546
10.1k32546
1
@Darth Kangooroo, in addition, you should also check out PhilHibbs answer in the same thread. He uses the information_schema to generateCOMMENT
statements.
– Lennart
Dec 21 '18 at 20:44
add a comment |
1
@Darth Kangooroo, in addition, you should also check out PhilHibbs answer in the same thread. He uses the information_schema to generateCOMMENT
statements.
– Lennart
Dec 21 '18 at 20:44
1
1
@Darth Kangooroo, in addition, you should also check out PhilHibbs answer in the same thread. He uses the information_schema to generate
COMMENT
statements.– Lennart
Dec 21 '18 at 20:44
@Darth Kangooroo, in addition, you should also check out PhilHibbs answer in the same thread. He uses the information_schema to generate
COMMENT
statements.– Lennart
Dec 21 '18 at 20:44
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- 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%2fdba.stackexchange.com%2fquestions%2f225589%2fpostgresql-delete-all-comments-from-database%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
You have not accepted an answer to any of your questions, yet. Please read meta.stackexchange.com/questions/5234/… and be more cooperative.
– Erwin Brandstetter
Jan 25 at 1:17