[ale] perl/postgresql question
Geoffrey Myers
lists at serioustechnology.com
Thu Mar 31 13:12:03 EDT 2011
Jim Kinney wrote:
> should it be replaced with nothing or with a NULL? Does the perl pointer
> jump to the next character automatically when a match is made thus
> skipping a character in your replace? Does a double run fix it?
My expectation is the 'g' at the end of the substitution should mean
globally.
It's interesting that you ask about multiple runs, because I was working
on the same database for a while, running multiple runs and at one point
had a clean database.
Problem is, I can not reproduce this and I suspect I had different code
at that time. Also, the perl script logs when it makes a change, so
when I see it run through every field/table, and reports 0 changes, then
I know it's not going to get anything a second time through.
>
> On Thu, Mar 31, 2011 at 12:04 PM, Geoffrey Myers
> <lists at serioustechnology.com <mailto:lists at serioustechnology.com>> wrote:
>
> So, we are trying to convert a number of postgresql databases that were
> created with SQL_ASCII encoding to UTF8 encoding. As such, I need to
> strip certain characters out of the data before dumping and reloading
> the new databases. I'm using the following:
>
> data =~ s/(.)/((ord($1) >= 0) && (ord($1) <= 8))
> || (ord($1) == 11)
> || ((ord($1) >= 13) && (ord($1) <= 31))
> || ((ord($1) >= 127)) ?"": $1/egs;
>
> Yet I'm getting the following error, which indicates a character that
> should be handled by the above code is still in the data:
>
> pg_restore: [archiver (db)] COPY failed: ERROR: invalid byte sequence
> for encoding "UTF8": 0xbd
>
>
> Certainly, the above code should replace the 0xbd with nothing?
>
> Any perl/postgres gurus out there?
>
> --
> Until later, Geoffrey
>
> "I predict future happiness for America if they can prevent
> the government from wasting the labors of the people under
> the pretense of taking care of them."
> - Thomas Jefferson
> _______________________________________________
> Ale mailing list
> Ale at ale.org <mailto:Ale at ale.org>
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>
>
>
> --
> --
> James P. Kinney III
> I would rather stumble along in freedom than walk effortlessly in chains.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
--
Until later, Geoffrey
"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson
More information about the Ale
mailing list