[GENERAL] interpret bytea output as text / double encode()

2014-06-06 Thread Stefan Froehlich
In one of my databases, I have mistakenly double encoded bytea values (i.e. the content is literally '\x202020...' which would have to be decoded once more to get the actually desired content). But how to get to the content? This: # select encode(column, 'escape') gives me the once-only encoded

Re: [GENERAL] interpret bytea output as text / double encode()

2014-06-06 Thread Stefan Froehlich
> > # select encode(encode(column, 'escape'), 'escape') > Any chance you can encode() into temp table then encode() the result. Don't think so, PostgreSQL will recognize the temp column either as text or as bytea and then refuse either the insert or the encode() because of a type mismatch. An

Re: [GENERAL] interpret bytea output as text / double encode()

2014-06-06 Thread Stefan Froehlich
On Fri, Jun 06, 2014 at 10:30:56AM -0400, Tom Lane wrote: > It's possible that what you are looking for is a binary-equivalent > cast from text to bytea, which you could create like this: > # create cast (text as bytea) without function; Hm. No, actually it does not help. But playing around with

[GENERAL] How to identify the source of a deadlock?

2013-01-24 Thread Stefan Froehlich
There is an application A doing some things in a database. In the middle of the program, application B is called which does some other things. Now for some reason application B hangs for certain inputs and I have to find out the reason for this. The sequence is: | A: BEGIN | A: [does some things]

[GENERAL] large INSERT leads to "invalid memory alloc"

2012-11-25 Thread Stefan Froehlich
While converting a mysql database into postgres, I stumbled over the following problem: | INSERT INTO a (id, fkid, displayorder, name, description, internal, mimetype, mimedata, filesize) VALUES (73,6,5, E'Seefeld.rar', E'Seefeld',0, E'application/octet-stream',decode('5261...0700', 'hex'),31148

Re: [GENERAL] large INSERT leads to "invalid memory alloc"

2012-11-25 Thread Stefan Froehlich
On Sun, Nov 25, 2012 at 06:57:22PM +0100, Pavel Stehule wrote: > > | INSERT INTO a (id, fkid, displayorder, name, description, internal, > > mimetype, mimedata, filesize) VALUES (73,6,5, E'Seefeld.rar', E'Seefeld',0, > > E'application/octet-stream',decode('5261...0700', 'hex'),311484587); > Atte