dbTalk Databases Forums  

[BUGS] reindexdb command utlility

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] reindexdb command utlility in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default [BUGS] reindexdb command utlility - 05-30-2006 , 03:46 PM






Hello Postgres team,

I used wanted to point out the the ( -q, --quiet ) parameter for
reindexdb command utility does not work.
Also reindexdb writes NOTICE to standard err for every table it
reindexes which makes it really hard to use in script as it always
produces an "errror". :-)

If this is the way it should work I would be interested in an
explanation. =)

Thank you for a wonderful database!

Regards,
Henrik


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 05-30-2006 , 08:47 PM







--5vNYLRcllDrimb99
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Quote:
I used wanted to point out the the ( -q, --quiet ) parameter for
reindexdb command utility does not work.
Actually it is *not* a bug. The NOTICE is printed by the REINDEX
command; reindexdb is just a wrapper around REINDEX command. If you
set up 'client_min_messages' in postgresql.conf, you don't get those
'annoying' messages.

Quote:
Also reindexdb writes NOTICE to standard err for every table it
reindexes which makes it really hard to use in script as it always
produces an "errror". :-)

You can always ignore NOTICE. grep is your friend. :-)

Looking at the code, IMHO we could raise the ereport from NOTICE to
INFO (see the patch attached). None of the scripts actually raise
NOTICEs if it succeeds.

Comments?


--
Euler Taveira de Oliveira
http://www.timbira.com/

--5vNYLRcllDrimb99
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="a.diff"

Index: src/backend/commands/indexcmds.c
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/indexcmds.c,v
retrieving revision 1.139
diff -c -r1.139 indexcmds.c
*** src/backend/commands/indexcmds.c 10 May 2006 23:18:39 -0000 1.139
--- src/backend/commands/indexcmds.c 31 May 2006 01:28:49 -0000
***************
*** 1108,1114 ****
/* functions in indexes may want a snapshot set */
ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
if (reindex_relation(relid, true))
! ereport(NOTICE,
(errmsg("table \"%s\" was reindexed",
get_rel_name(relid))));
CommitTransactionCommand();
--- 1108,1114 ----
/* functions in indexes may want a snapshot set */
ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
if (reindex_relation(relid, true))
! ereport(INFO,
(errmsg("table \"%s\" was reindexed",
get_rel_name(relid))));
CommitTransactionCommand();

--5vNYLRcllDrimb99
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

--5vNYLRcllDrimb99--



Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 05-31-2006 , 07:44 AM




31 maj 2006 kl. 03:47 skrev Euler Taveira de Oliveira:

Quote:
I used wanted to point out the the ( -q, --quiet ) parameter for
reindexdb command utility does not work.
Actually it is *not* a bug. The NOTICE is printed by the REINDEX
command; reindexdb is just a wrapper around REINDEX command. If you
set up 'client_min_messages' in postgresql.conf, you don't get those
'annoying' messages.
I'll take a look at that. I have to make sure that I don't need it
somewhere else first. :-)
Quote:
Also reindexdb writes NOTICE to standard err for every table it
reindexes which makes it really hard to use in script as it always
produces an "errror". :-)

You can always ignore NOTICE. grep is your friend. :-)
True, but usually I like to have my ERROR messages to stderr and INFO
to stdout.

Quote:
Looking at the code, IMHO we could raise the ereport from NOTICE to
INFO (see the patch attached). None of the scripts actually raise
NOTICEs if it succeeds.

Comments?
INFO sounds like a good idea. What do you think about sending INFO to
stdout instead of stderr? (As it seems that ereport() automagically
sends the message to stderr)

Cheers,
Henrik
Quote:

--
Euler Taveira de Oliveira
http://www.timbira.com/
a.diff

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #4  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 05-31-2006 , 06:21 PM



Henrik Zagerholm wrote:

Quote:
You can always ignore NOTICE. grep is your friend. :-)
True, but usually I like to have my ERROR messages to stderr and INFO
to stdout.

But it's not true in PostgreSQL. All ereport() messages are sent to
stderr. In some scripts, the -e (echo) is used to print command to
stdout. Like I said, you need to "| grep -v" your stderr output.


--
Euler Taveira de Oliveira
http://www.timbira.com/


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #5  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 06-07-2006 , 08:16 AM




Patch applied. Thanks.

---------------------------------------------------------------------------


Euler Taveira de Oliveira wrote:
Quote:
I used wanted to point out the the ( -q, --quiet ) parameter for
reindexdb command utility does not work.
Actually it is *not* a bug. The NOTICE is printed by the REINDEX
command; reindexdb is just a wrapper around REINDEX command. If you
set up 'client_min_messages' in postgresql.conf, you don't get those
'annoying' messages.

Also reindexdb writes NOTICE to standard err for every table it
reindexes which makes it really hard to use in script as it always
produces an "errror". :-)

You can always ignore NOTICE. grep is your friend. :-)

Looking at the code, IMHO we could raise the ereport from NOTICE to
INFO (see the patch attached). None of the scripts actually raise
NOTICEs if it succeeds.

Comments?


--
Euler Taveira de Oliveira
http://www.timbira.com/
[ Attachment, skipping... ]

Quote:
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
  #6  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 06-07-2006 , 09:26 AM



Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes:
Quote:
Patch applied. Thanks.
Why is this an improvement? AFAIR an INFO message is *not suppressible*
by adjusting client_min_messages, therefore this makes the system more
chatty not less so. It certainly doesn't do anything to address the
original complaint.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #7  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 06-07-2006 , 12:03 PM



Tom Lane wrote:
Quote:
Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes:
Patch applied. Thanks.

Why is this an improvement? AFAIR an INFO message is *not suppressible*
by adjusting client_min_messages, therefore this makes the system more
chatty not less so. It certainly doesn't do anything to address the
original complaint.
I thought it needed changing for consistency. Shouldn't status messages
like this be INFO:

test=> REINDEX DATABASE test;
NOTICE: table "pg_class" was reindexed
NOTICE: table "sql_languages" was reindexed
NOTICE: table "sql_packages" was reindexed
NOTICE: table "sql_parts" was reindexed

If I do VACUUM VERBOSE, those messages are INFO.

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #8  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 06-07-2006 , 12:18 PM



Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes:
Quote:
I thought it needed changing for consistency. Shouldn't status messages
like this be INFO:
test=> REINDEX DATABASE test;
NOTICE: table "pg_class" was reindexed

If I do VACUUM VERBOSE, those messages are INFO.
Yeah, *only because you said VERBOSE*. When we implemented the current
elog level scheme, we designed INFO as non-suppressible so that it would
mimic the previous behavior of VACUUM VERBOSE.

If REINDEX had a VERBOSE option, it would make sense to put out the
messages as INFO when VERBOSE was used. But it doesn't (and this is
not a request to add one). Without VERBOSE, I think it's utterly
unacceptable to force the messages out regardless of client_min_messages.
NOTICE was a reasonable level, maybe LOG would be a better one. But
not INFO.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #9  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 06-07-2006 , 12:22 PM



Tom Lane wrote:
Quote:
Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes:
I thought it needed changing for consistency. Shouldn't status messages
like this be INFO:
test=> REINDEX DATABASE test;
NOTICE: table "pg_class" was reindexed

If I do VACUUM VERBOSE, those messages are INFO.

Yeah, *only because you said VERBOSE*. When we implemented the current
elog level scheme, we designed INFO as non-suppressible so that it would
mimic the previous behavior of VACUUM VERBOSE.

If REINDEX had a VERBOSE option, it would make sense to put out the
messages as INFO when VERBOSE was used. But it doesn't (and this is
not a request to add one). Without VERBOSE, I think it's utterly
unacceptable to force the messages out regardless of client_min_messages.
NOTICE was a reasonable level, maybe LOG would be a better one. But
not INFO.
OK, reverted.

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #10  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] reindexdb command utlility - 06-07-2006 , 07:55 PM




--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Tom Lane wrote:

Quote:
Yeah, *only because you said VERBOSE*. When we implemented the current
elog level scheme, we designed INFO as non-suppressible so that it would
mimic the previous behavior of VACUUM VERBOSE.

Agreed.

Quote:
If REINDEX had a VERBOSE option, it would make sense to put out the
messages as INFO when VERBOSE was used. But it doesn't (and this is
not a request to add one). Without VERBOSE, I think it's utterly
unacceptable to force the messages out regardless of client_min_messages.
NOTICE was a reasonable level, maybe LOG would be a better one. But
not INFO.

LOG would be a good option, but maybe a small hack in reindexdb is
better.


--
Euler Taveira de Oliveira
http://www.timbira.com/

--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="r.diff"

Index: src/bin/scripts/reindexdb.c
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/reindexdb.c,v
retrieving revision 1.5
diff -c -r1.5 reindexdb.c
*** src/bin/scripts/reindexdb.c 5 Mar 2006 15:58:52 -0000 1.5
--- src/bin/scripts/reindexdb.c 8 Jun 2006 00:42:44 -0000
***************
*** 229,234 ****
--- 229,241 ----

conn = connectDatabase(dbname, host, port, username, password, progname);

+ /* Suppress some NOTICE messages from REINDEX command */
+ if (quiet)
+ {
+ result = PQexec(conn, "SET client_min_messages = warning");
+ PQclear(result);
+ }
+
if (echo)
printf("%s", sql.data);
result = PQexec(conn, sql.data);

--VS++wcV0S1rZb1Fb
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

--VS++wcV0S1rZb1Fb--



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.