Re: [SQL] getting details about integrity constraint violation

2005-06-03 Thread KÖPFERL Robert
| |You can't, at the moment, except by parsing the text message. | |The error fields facility in the FE/BE protocol could be extended |in that direction, and I think there's already been some discussion |about it; but no one has stepped up with a concrete proposal, much |less volunteered to do

Re: [SQL] getting details about integrity constraint violation

2005-06-03 Thread Markus Bertheau ☭
, 03/06/2005 10:00 +0200, KPFERL Robert : | |You can't, at the moment, except by parsing the text message. | |The error fields facility in the FE/BE protocol could be extended |in that direction, and I think there's already been some discussion |about it; but no one has stepped up with a

[SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Markus Bertheau ☭
Hi, What's the type I need to convert text to before I can convert it to boolean? Markus -- Markus Bertheau [EMAIL PROTECTED] ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Achilleus Mantzios
O Markus Bertheau ^ Jun 3, 2005 : Hi, What's the type I need to convert text to before I can convert it to boolean? just 't' will suffice. Markus -- -Achilleus ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Markus Bertheau ☭
, 03/06/2005 14:20 +0300, Achilleus Mantzios : O Markus Bertheau ^ Jun 3, 2005 : Hi, What's the type I need to convert text to before I can convert it to boolean? just 't' will suffice. Well, that's not my question. I have a plpgsql function like that: CREATE FUNCTION

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Achilleus Mantzios
O Markus Bertheau ^ Jun 3, 2005 : ? ??, 03/06/2005 14:20 +0300, Achilleus Mantzios ??: O Markus Bertheau ^ ?? ??? Jun 3, 2005 : Hi, What's the type I need to convert text to before I can convert it to boolean? just 't' will suffice. Well, that's not my question. I

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Markus Bertheau ☭
, 03/06/2005 14:45 +0300, Achilleus Mantzios : Then use the case when ... then ... when ... then ... else ... end construct, e.g. case when mytext='true' then 't'::boolean else 'f'::boolean end Because I don't want to reimplement postgres' boolean parsing. Hmm, why dont you leave it as

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Michael Glaesemann
On Jun 3, 2005, at 8:52 PM, Markus Bertheau wrote: And I can't call it with a TEXT variable, because casting from TEXT to BOOLEAN isn't possible. I'd be surprised if there weren't a some way to coerce the cast from text to boolean, but you might want to just make a simple convenience

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Michael Glaesemann
On Jun 3, 2005, at 9:23 PM, Markus Bertheau wrote: This also bypasses the built in postgresql boolean literal parsing. I think casting from text to boolean should be possible, and use the same algorithm that's used when casting from unknown to boolean. Actually, looking at the system

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Markus Bertheau ☭
This also bypasses the built in postgresql boolean literal parsing. I think casting from text to boolean should be possible, and use the same algorithm that's used when casting from unknown to boolean. Markus , 03/06/2005 21:14 +0900, Michael Glaesemann : On Jun 3, 2005, at 8:52 PM, Markus

Re: [SQL] index row size 2728 exceeds btree maximum, 27

2005-06-03 Thread Richard Huxton
Bruno Wolff III wrote: On Thu, Jun 02, 2005 at 18:00:17 +0100, Richard Huxton dev@archonet.com wrote: Certainly, but if the text in the logfile row is the same, then hashing isn't going to make a blind bit of difference. That's the root of my concern, and something only Dinesh knows.

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Achilleus Mantzios
O Michael Glaesemann Jun 3, 2005 : On Jun 3, 2005, at 9:23 PM, Markus Bertheau ? wrote: This also bypasses the built in postgresql boolean literal parsing. I think casting from text to boolean should be possible, and use the same algorithm that's used when casting from unknown to

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Markus Bertheau ☭
, 03/06/2005 15:46 +0300, Achilleus Mantzios : Also according to the docs: http://www.postgresql.org/docs/current/static/datatype-boolean.html Tip: Values of the boolean type cannot be cast directly to other types (e.g., CAST (boolval AS integer) does not work). This can be accomplished

[SQL] CASE WHEN foo IS NULL THEN DEFAULT ELSE foo END

2005-06-03 Thread Markus Bertheau ☭
Hi, is it planned to support the following insert syntax? INSERT INTO table VALUES (CASE WHEN arg_whatever IS NULL THEN DEFAULT ELSE arg_whatever END); I have the DEFAULT inside the CASE expression in mind. Markus -- Markus Bertheau [EMAIL PROTECTED] ---(end of

Re: [SQL] 'true'::TEXT::BOOLEAN doesn't work

2005-06-03 Thread Markus Bertheau ☭
, 03/06/2005 15:07 +0200, Markus Bertheau : , 03/06/2005 15:46 +0300, Achilleus Mantzios : Also according to the docs: http://www.postgresql.org/docs/current/static/datatype-boolean.html Tip: Values of the boolean type cannot be cast directly to other types (e.g., CAST (boolval

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Tom Lane
Markus Bertheau =?UTF-8?Q?=E2=98=AD?= [EMAIL PROTECTED] writes: Well, that's not my question. I have a plpgsql function like that: ... And I can't call it with a TEXT variable, because casting from TEXT to BOOLEAN isn't possible. In plpgsql it is: just assign the text value to a boolean

Re: [SQL] CASE WHEN foo IS NULL THEN DEFAULT ELSE foo END

2005-06-03 Thread Tom Lane
Markus Bertheau =?UTF-8?Q?=E2=98=AD?= [EMAIL PROTECTED] writes: is it planned to support the following insert syntax? INSERT INTO table VALUES (CASE WHEN arg_whatever IS NULL THEN DEFAULT ELSE arg_whatever END); No. AFAICS, SQL99 only defines DEFAULT as the direct INSERT or UPDATE target

[SQL] using a selected row as a function parameter

2005-06-03 Thread Ami Ganguli
Hi all, I've been struggling with this for a while and haven't found anything on the 'Net about it. I've created a function that takes two table rows as a parameters. I'd like to use the output of a select (two single rows) as the parameters, but I can't get it to work. What am I missing? The

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Bruno Wolff III
On Fri, Jun 03, 2005 at 14:23:37 +0200, Markus Bertheau ??? [EMAIL PROTECTED] wrote: This also bypasses the built in postgresql boolean literal parsing. I think casting from text to boolean should be possible, and use the same algorithm that's used when casting from unknown to boolean. You

Re: [SQL] using a selected row as a function parameter

2005-06-03 Thread Tom Lane
Ami Ganguli [EMAIL PROTECTED] writes: SELECT queue.apply_routing_rule( (SELECT * from queue.messages WHERE id = 1), (SELECT * from queue.routing_rules WHERE id = 1) ); Not sure if that particular syntax should be expected to

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Tom Lane
Bruno Wolff III [EMAIL PROTECTED] writes: Markus Bertheau ??? [EMAIL PROTECTED] wrote: I think casting from text to boolean should be possible, and use the same algorithm that's used when casting from unknown to boolean. You probably want boolin. That won't actually work either, because

Re: [SQL] using a selected row as a function parameter

2005-06-03 Thread Michael Fuhr
On Fri, Jun 03, 2005 at 05:44:59PM +0300, Ami Ganguli wrote: SELECT queue.apply_routing_rule( (SELECT * from queue.messages WHERE id = 1), (SELECT * from queue.routing_rules WHERE id = 1) ); I get an error message along the

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Markus Bertheau ☭
, 03/06/2005 11:28 -0400, Tom Lane : There's been discussion of allowing all datatypes to be explicitly casted to or from text by generating conversions like these automatically. But I'm not sure if everyone's convinced it's a good idea or not. I certainly consider the way you proposed

Re: [SQL] 'true'::TEXT::BOOLEAN

2005-06-03 Thread Bruno Wolff III
On Fri, Jun 03, 2005 at 11:28:02 -0400, Tom Lane [EMAIL PROTECTED] wrote: That won't actually work either, because boolin wants cstring: Thanks for pointing that out. I was actually surprised to see my test work, since I knew boolin expected cstring. I forgot that by not providing a type

Re: [SQL] getting details about integrity constraint violation

2005-06-03 Thread PFC
The error fields facility in the FE/BE protocol could be extended in that direction, and I think there's already been some discussion about it; but no one has stepped up with a concrete proposal, much less volunteered to do the work ... Um, if changing the protocol is a bother, you could