--
You received this message because you are subscribed to the Google Groups "PgDBF" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgdbf+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
It used decimal instead of numeric so I made that change and tried it but gotERROR: invalid byte sequence for encoding "UTF8": 0xadso I used iconv. That server has the older version of your program.I used pgdbf -q -D arymst01.dbf -m arymst01.fpt | sed 's/DECIMAL(4)/NUMERIC(12, 4)/g' | iconv -c -f UTF-8 -t UTF-8 | psql -d slauson and that worked.ThanksMichael
On Thu, Oct 24, 2013 at 5:03 PM, Philipp Wollermann <philipp.w...@gmail.com> wrote:
I wouldn't recommend to use the "iconv" command unless it is absolutely needed, because it may corrupt your data in the SQL. It also produced errors like you had in my case. It is the method of last resort only in case the data in your original files is already corrupt.
Except for that, what you're doing looks correct to me.Could you try the following command:pgdbf -q -D arymst01.dbf -m arymst01.fpt | sed 's/NUMERIC(4, 0)/NUMERIC(12, 4)/g' | psql -d slausonWhat this does is, run pgdbf with mostly default options (option -q means: quote the table names), replace the wrong NUMERIC fields with the bigger ones and pipe the output directly to Postgres. If it works as-is, that's great.If not, it would be helpful if you can figure out the charset of your data. For that, could you install "chardet" (see https://pypi.python.org/pypi/chardet) and run it on the SQL output? You can install it via pip, easy_install or probably apt-get (the Ubuntu package is called python-chardet).Then, run:pgdbf -D arymst01.dbf -m arymst01.fpt > ar1.sqlchardet ar1.sqland please post the output.On Fri, Oct 25, 2013 at 7:55 AM, Michael Martin <mma...@slauson.com> wrote:Yes the same error message. It changed everything to decimal..I exported it to a text file then changed the field to NUMERIC(12, 4)If I could ask another question how do you get the file into Postgres?pgdbf -D arymst01.dbf -m arymst01.fpt | iconv -c -f UTF-8 -t UTF-8 | >ar1.sqlpsql -d slauson -f ar1.sqlI keep getting psql:ar1.sql:3173: invalid command \NthanksMichael
On Thu, Oct 24, 2013 at 3:36 PM, Philipp Wollermann <philipp.w...@gmail.com> wrote:Sorry, did you get the same error message with -N or something else?Also you could try to modify the generated SQL and change the data types from NUMERIC(4, 0) to something bigger like NUMERIC(12, 4). To do that, save the output of pgdbf to a file, open it with a text editor and search (and replace) the wrong NUMERIC fields.That would be even better than using -N. After you modified the SQL, run it with Postgres as usual. If you get another error, feel free to post it.On Fri, Oct 25, 2013 at 6:20 AM, Michael Martin <mma...@slauson.com> wrote:I tried -N that didn't work.