Postgresql: delete all comments from database





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















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 ?










share|improve this question























  • 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


















3















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 ?










share|improve this question























  • 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














3












3








3








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 ?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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










1 Answer
1






active

oldest

votes


















2














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.






share|improve this answer



















  • 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














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
});


}
});














draft saved

draft discarded


















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









2














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.






share|improve this answer



















  • 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


















2














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.






share|improve this answer



















  • 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
















2












2








2







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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 generate COMMENT statements.

    – Lennart
    Dec 21 '18 at 20:44
















  • 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










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




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Plaza Victoria

Puebla de Zaragoza

Musa