X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F066A53A12 for ; Fri, 22 Apr 2005 14:01:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96365-03 for ; Fri, 22 Apr 2005 17:01:48 +0000 (GMT) Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id E4FF9539DD for ; Fri, 22 Apr 2005 14:01:46 -0300 (ADT) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 22 Apr 2005 12:01:45 -0500 Subject: Re: Reindex from command line linux From: Scott Marlowe To: FBaron@co.belcorp.biz Cc: Bruno Wolff III , pgsql-admin@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-Id: <1114189305.13303.62.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 22 Apr 2005 12:01:45 -0500 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.267 tagged_above=0 required=5 tests=AWL, BIZ_TLD X-Spam-Level: X-Archive-Number: 200504/316 X-Sequence-Number: 17329 On Fri, 2005-04-22 at 11:36, FBaron@co.belcorp.biz wrote: >=20 >=20 > 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=C2=B4t exsists) >=20 > I execute : >=20 > psql -d Clibelcorpco -c "REINDEX DATABASE Clibelcorpco FORCE" > ERROR: REINDEX DATABASE: Can be executed only on the currently open > database. >=20 > 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.