Re: Reindex from command line linux

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: FBaron(at)co(dot)belcorp(dot)biz
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Reindex from command line linux
Date: 2005-04-22 17:01:45
Message-ID: 1114189305.13303.62.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, 2005-04-22 at 11:36, FBaron(at)co(dot)belcorp(dot)biz wrote:
>
>
> thanks Bruno :
> I'm running the command with root
> psql -c "REINDEX DATABASE Clibelcorpco FORCE"
> psql: FATAL: La base de datos "root" no existe en el catalogo del
> sistema.(Traslate : The "root" database doesn´t exsists)
>
> I execute :
>
> psql -d Clibelcorpco -c "REINDEX DATABASE Clibelcorpco FORCE"
> ERROR: REINDEX DATABASE: Can be executed only on the currently open
> database.
>
> what do you think?

If this is a cron job you can either schedule it to be run by the
postgres super user's crontab (su - postgres, crontab -e) OR you can use
su - from root's crontab to run this as the postgres (or other) super
user.

su - postgres -c 'psql dbnamehere -c "reindex database"'

I think I got the quoting right there, not guaranteed though.

Note that you are using upper / lower case mixed. Inside the psql
environment, unquoted identifiers are lower case. However, to psql, the
identifier is used "as is". So, to access the Db1 database, you'd have
to enter it correctly, but need no quotes:

psql Db1 -c 'reindex database'

I recommend just sticking to lower case unless you have a business rule
that makes you use mixed case in identifiers. Life it much simpler that
way.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tomeh, Husam 2005-04-22 17:03:22 Re: Another Data directory for second database -
Previous Message Joshua D. Drake 2005-04-22 16:50:53 Re: Reindex from command line linux