pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DELETE FROM pg_description WHERE ...
5+ messages / 3 participants
[nested] [flat]

* DELETE FROM pg_description WHERE ...
@ 2011-04-22 16:26  Erwin Brandstetter <brsaweda@gmail.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Erwin Brandstetter @ 2011-04-22 16:26 UTC (permalink / raw)
  To: pgsql-admin

Hi!

It is generally not advisable to write to system catalogs directly ...

However, I have a database with dozens of schemas and hundreds of
tables. There is a bunch of useless comments on columns I want to get
rid of, scattered all across the db. The fastest & easiest way would
be:

DELETE FROM pg_description WHERE description = 'My very special
totally useless comment.';

AFAICS, there are no side-effects. Are there any?


TIA!
Erwin Brandstetter



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DELETE FROM pg_description WHERE ...
@ 2011-04-23 03:21  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Erwin Brandstetter <brsaweda@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Tom Lane @ 2011-04-23 03:21 UTC (permalink / raw)
  To: Erwin Brandstetter <brsaweda@gmail.com>; +Cc: pgsql-admin

Erwin Brandstetter <brsaweda@gmail.com> writes:
> However, I have a database with dozens of schemas and hundreds of
> tables. There is a bunch of useless comments on columns I want to get
> rid of, scattered all across the db. The fastest & easiest way would
> be:

> DELETE FROM pg_description WHERE description = 'My very special
> totally useless comment.';

> AFAICS, there are no side-effects. Are there any?

It's safe enough, as long as you don't delete the wrong comments.
There's no hidden infrastructure for a comment.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DELETE FROM pg_description WHERE ...
@ 2011-04-23 22:54  Erwin Brandstetter <brsaweda@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Erwin Brandstetter @ 2011-04-23 22:54 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

On 23.04.2011 05:21, Tom Lane wrote:
> Erwin Brandstetter<brsaweda@gmail.com>  writes:
>> However, I have a database with dozens of schemas and hundreds of
>> tables. There is a bunch of useless comments on columns I want to get
>> rid of, scattered all across the db. The fastest&  easiest way would
>> be:
>> DELETE FROM pg_description WHERE description = 'My very special
>> totally useless comment.';
>> AFAICS, there are no side-effects. Are there any?
> It's safe enough, as long as you don't delete the wrong comments.
> There's no hidden infrastructure for a comment.
>
> 			regards, tom lane
>

Thank you for your answers!

Regards
Erwin




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DELETE FROM pg_description WHERE ...
@ 2011-04-24 15:25  Simon Riggs <simon@2ndQuadrant.com>
  parent: Erwin Brandstetter <brsaweda@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Simon Riggs @ 2011-04-24 15:25 UTC (permalink / raw)
  To: Erwin Brandstetter <brsaweda@gmail.com>; +Cc: pgsql-admin

On Fri, Apr 22, 2011 at 5:26 PM, Erwin Brandstetter <brsaweda@gmail.com> wrote:
> Hi!
>
> It is generally not advisable to write to system catalogs directly ...
>
> However, I have a database with dozens of schemas and hundreds of
> tables. There is a bunch of useless comments on columns I want to get
> rid of, scattered all across the db. The fastest & easiest way would
> be:
>
> DELETE FROM pg_description WHERE description = 'My very special
> totally useless comment.';

Why would you *not* use the COMMENT command for that?

What is slower or harder about using it?

-- 
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DELETE FROM pg_description WHERE ...
@ 2011-04-24 16:27  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2011-04-24 16:27 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndQuadrant.com>; +Cc: Erwin Brandstetter <brsaweda@gmail.com>; pgsql-admin

Simon Riggs <simon@2ndQuadrant.com> writes:
> On Fri, Apr 22, 2011 at 5:26 PM, Erwin Brandstetter <brsaweda@gmail.com> wrote:
>> DELETE FROM pg_description WHERE description = 'My very special
>> totally useless comment.';

> Why would you *not* use the COMMENT command for that?

If what he wants is to drop comments containing a particular string,
COMMENT isn't an especially easy way to do it.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2011-04-24 16:27 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-22 16:26 DELETE FROM pg_description WHERE ... Erwin Brandstetter <brsaweda@gmail.com>
2011-04-23 03:21 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-04-23 22:54   ` Erwin Brandstetter <brsaweda@gmail.com>
2011-04-24 15:25 ` Simon Riggs <simon@2ndQuadrant.com>
2011-04-24 16:27   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox