On Fri, 2005-04-22 at 11:36, FBaron@xxxxxxxxxxxxxx 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.