[ewiki] Re: postgresql and uploads

"Josh More" <morej@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> uploads.  It seems as if text-based uploads work properly, but whenever
> I try to upload binary data, it gets garbled somehow.  In particular,
> the file size changes.

ewiki here sufferes from originally being designed for MySQL, which 
lacks understanding of charsets, and therefore allows all sorts of  
data being stored in TEXT columns. Postgresl, being a more scientific
and less general database, mandates that all data in TEXT fields be of
a given charset, and therefore rejects input which doesn't meet all  
criteria. So you end up with mangled or shortened entries in the SQL
table.

There exist two workarounds. First was to change the "content" column
into a BLOB (or "BYTEA" for PG). Secondly you could enable the
EWIKI_DB_BIN64 hack, which transforms all _BINARY entries using the 
base64-encoding before saving it. While the latter is safe, it will 
yield lousy performance.

However, work is underway to finally get a database backend tailored
to PG. See [http://erfurtwiki.sf.net/anydb] (didn't notice the down,
btw).
My idea is, that we introduce a "binary" column, which gets the
data that "content" would hold for ordinary text page entries in the
ewiki SQL table. The database backend took care to choose the right
one to read and write (based on the _BINARY flag for example). This
looks easier than introducing a secondary table and SQL views only
for binary entries.

And it is time for a anydb replacement, because there were far too
many bugs in it by now; also a lof of people seem to use ewiki with
PG already.

mario

Other related posts: