Thread: encoding problems
I'm not sure how to ask this question. I have written a function, and with PostgreSQL 8.0.13 I can do a "\df+" and see something like this under Source Code: DECLARE result text; BEGIN result := (SELECT SUBSTRING(fname FROM 1 FOR 1) || SUBSTRING(mname FROM 1 FOR 1) || SUBSTRING(lname FROM 1 FOR 1) FROM employees WHERE id = empid); RETURN result; END; If I create the same function on my computer running PostgreSQL 8.3.0 and try the \df+ then the Source Code shows: \x09DECLARE \x09\x09result text; : \x09 : \x09BEGIN : \x09\x09result := (SELECT SUBSTRING(fname FROM 1 FOR 1) || : \x09\x09\x09\x09\x09\x09SUBSTRING(mname FROM 1 FOR 1) || : \x09\x09\x09\x09\x09\x09SUBSTRING(lname FROM 1 FOR 1) : \x09\x09\x09\x09\x09\x09FROM employees WHERE id = empid); : \x09\x09RETURN result; : \x09END; I've tried changing the database encoding and some other things, but can't seem to fix this.
Cliff Nieuwenhuis <cliff@nieusite.com> writes: > I'm not sure how to ask this question. I have written a function, and with > PostgreSQL 8.0.13 I can do a "\df+" and see something like this under Source > Code: > DECLARE > result text; > ... > If I create the same function on my computer running PostgreSQL 8.3.0 and try > the \df+ then the Source Code shows: > \x09DECLARE > \x09\x09result text; > ... That's not an encoding problem, that's an intentional behavioral change in the way that psql formats strings for display. I guess it's a bit annoying if you were hoping that tabs would be useful for pretty-printing purposes. Should we reconsider what's done with a tab in mbprint.c? regards, tom lane
On Tuesday 11 March 2008 11:41:35 Tom Lane wrote: > Cliff Nieuwenhuis <cliff@nieusite.com> writes: > > I'm not sure how to ask this question. I have written a function, and > > with PostgreSQL 8.0.13 I can do a "\df+" and see something like this > > under Source Code: > > DECLARE > > result text; > > ... > > > > If I create the same function on my computer running PostgreSQL 8.3.0 and > > try the \df+ then the Source Code shows: > > > > \x09DECLARE > > \x09\x09result text; > > ... > > That's not an encoding problem, that's an intentional behavioral change > in the way that psql formats strings for display. > > I guess it's a bit annoying if you were hoping that tabs would be useful > for pretty-printing purposes. Should we reconsider what's done with a > tab in mbprint.c? > > regards, tom lane My vote would be to go back to the old way, or at least have that as an option of some sort. I use command-line psql all the time -- to me, psql offers the same advantages as using a command-line interface for other work. I find the extra characters really get in the way. Thanks for the prompt reply! -- Cliff
Martijn van Oosterhout <kleptog@svana.org> writes: > The other alternative is to convert tabs to spaces on output. Can't > remember why we didn't do that. Yeah. The idea I had was to invent a parameter specifying the number of spaces a tab should expand to --- setting this to zero would give you the current \x09 behavior. I'm not sure how painful it would be to expand tabs properly in mbprint, but it seems possible. regards, tom lane