Thread: Re: After upgrade pg_dumpall fails (SOLVED)

Re: After upgrade pg_dumpall fails (SOLVED)

From
Patrick Nelson
Date:
Patrick Nelson wrote:
----------------->>>>
Spent yesterday upgrading to 7.2.1, wasn't a walk in the park but it's
working.

Last night my system ran a pg_dumpall and displayed an error:

--
-- pg_dumpall (7.2.1)
--
\connect template1
DELETE FROM pg_shadow WHERE usesysid <> (SELECT datdba FROM pg_database
WHERE datname = 'template0');

connected to template1...
ERROR:  Unable to convert abstime 'invalid' to timestamptz

The error seems to come from pg_dumpall at the following line:

$PSQL -d template1 -At -c "\
SELECT
  'CREATE USER \"' || usename || '\" WITH SYSID ' || usesysid
  || CASE WHEN passwd IS NOT NULL THEN ' PASSWORD ''' || passwd || '''' else
'' end
  || CASE WHEN usecreatedb THEN ' CREATEDB'::text ELSE ' NOCREATEDB' END
  || CASE WHEN usesuper THEN ' CREATEUSER'::text ELSE ' NOCREATEUSER' END
  || CASE WHEN valuntil IS NOT NULL THEN ' VALID UNTIL '''::text
    || CAST(valuntil AS TIMESTAMP) || '''' ELSE '' END || ';'
FROM pg_shadow
WHERE usesysid <> (SELECT datdba FROM pg_database WHERE datname =
'template0');" \

Looking at pg_shadow the structure looks like:

# \d pg_shadow
         Table "pg_shadow"
   Column    |  Type   | Modifiers
-------------+---------+-----------
 usename     | name    |
 usesysid    | integer |
 usecreatedb | boolean |
 usetrace    | boolean |
 usesuper    | boolean |
 usecatupd   | boolean |
 passwd      | text    |
 valuntil    | abstime |
Unique keys: pg_shadow_usename_index,
             pg_shadow_usesysid_index
Triggers: pg_sync_pg_pwd

Is valuntil's type improper?  Anything else that might cause this?
----------------->>>>

Oops thought I should add this:

select valuntil from pg_shadow;
 valuntil
----------




 invalid
(5 rows)
----------------->>>>

Shoot didn't notice that invalid line... duh!  Did a dropuser on him and
then createuser and then tried pg_dumpall again...  It worked.