Обсуждение: Field name problem
I built an application last year which used the name "over" as the name of a boolean field in one of the tables. It was in regular use last year and worked fine. I have been regularly taking backups with of this database with the following command pg_dump -Fc melindas_ball | gzip -9 > ball.sql.gz and, in the past - last year - managed to recover the data from a backup. The server (a hosting service) this runs on is currently running 8.1.11 I discovered yesterday that for some unknown reason my hosting service seems to have lost the data in the database. The structure is there, but the data is gone. So I went back to a backup and loaded it on. It loaded OK (I can see it in phppgadmin) but there was something wrong with the complex display of the first page of my application (the queries it uses hadn't completed in 10 minutes). I know there is a large number of queries and might need some optimisation So I tried to load the same database on my home machine using pg_restore. This runs version 8.4.0, and it failed loading the restore with and error at this field "over" because, I presume, its a reserved word in SQL. Is there anyway, I can access any of my other backups and load the data in a current database? -- Alan Chandler http://www.chandlerfamily.org.uk
Alan Chandler <alan@chandlerfamily.org.uk> wrote: > [...] > So I tried to load the same database on my home machine > using pg_restore. This runs version 8.4.0, and it failed > loading the restore with and error at this field "over" > because, I presume, its a reserved word in SQL. > Is there anyway, I can access any of my other backups and > load the data in a current database? a) Install an old PostgreSQL server, restore to it, change the attribute name, dump from it, restore to a new ser- ver. b) Restore the backup to an SQL file, load it into a suit- able editor, change (very carefully) "over" to the new attribute name and restore that file to a new server. Tim
Tim Landscheidt wrote: > b) Restore the backup to an SQL file, load it into a suit- > able editor, change (very carefully) "over" to the new > attribute name and restore that file to a new server. > Thats what I had hoped to be able to do (I've got to search several backups for the one with the exact right dataset and I don't want to be changing postgresql versions all the time), I read the pg_restore man page over and over before posting. Looking again after your post I see now to just leave out the database name duh. Thanks -- Alan Chandler http://www.chandlerfamily.org.uk