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 al

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] '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 y

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 alo

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,

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

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 boolea

[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] 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

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] '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 othe

[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 br

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 b

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 cas

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

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 tab

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 f

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 yo

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?

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 li

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

[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 co

Re: [SQL] getting details about integrity constraint violation

2005-06-03 Thread Markus Bertheau ☭
В Птн, 03/06/2005 в 10:00 +0200, 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 s

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 t

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 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. Sure it is. Because