Re: [HACKERS] Why is this allowed?
Chuck McDevitt [EMAIL PROTECTED] writes: Why don't we have some kind of error check for people entering things like INTERVAL '1' DAY in their query, since we don't handle it. Because it's not an error. It just doesn't mean what you think it means. You've requested an interval measured in days and supplied '1' as the value which is read as a single second. Hm, the documentation doesn't describe this syntax but the comments in the source imply that this postfix precision notation is required and there's quite a bit of code in gram.y to support it. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [HACKERS] Why is this allowed?
Gregory Stark [EMAIL PROTECTED] writes: Chuck McDevitt [EMAIL PROTECTED] writes: Why don't we have some kind of error check for people entering things like INTERVAL '1' DAY in their query, since we don't handle it. Because it's not an error. It just doesn't mean what you think it means. You've requested an interval measured in days and supplied '1' as the value which is read as a single second. Actually sorry, that's true but it seems it's a bug. The comments even use the example INTERVAL '1' YEAR which one imagines the author didn't intend to be parsed as a 1 second interval measured in years. Looking more at it now. There are a couple different grammar productions that look like they might be relevant, I'm not sure which is getting used here. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [HACKERS] Why is this allowed?
Gregory Stark [EMAIL PROTECTED] writes: Chuck McDevitt [EMAIL PROTECTED] writes: Why don't we have some kind of error check for people entering things like INTERVAL '1' DAY in their query, since we don't handle it. Because it's not an error. It just doesn't mean what you think it means. What it is is an incompletely implemented feature. That syntax is required by the SQL spec, and Tom Lockhart had been making progress towards supporting it when he got bored and left the project. Where he left it is that the grammar accepts it but the interval input routine isn't paying any attention to the qualifier. I'm not eager to rip out what's there, but I don't personally feel like making it work either... regards, tom lane ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [HACKERS] Why is this allowed?
Ok... Just to be clear, the ISO SQL spec says that INTERVAL '1' DAY is the correct way to specify a one-day interval. That's why it is surprising that PostgreSQL treats it differently, with no error or warning. The PostgreSQL syntax INTERVAL '1 DAY' is non-standard. Is fixing this on the TODO list? -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Saturday, March 10, 2007 5:11 PM To: Gregory Stark Cc: Chuck McDevitt; pgsql-hackers@postgresql.org Subject: Re: [HACKERS] Why is this allowed? Gregory Stark [EMAIL PROTECTED] writes: Chuck McDevitt [EMAIL PROTECTED] writes: Why don't we have some kind of error check for people entering things like INTERVAL '1' DAY in their query, since we don't handle it. Because it's not an error. It just doesn't mean what you think it means. What it is is an incompletely implemented feature. That syntax is required by the SQL spec, and Tom Lockhart had been making progress towards supporting it when he got bored and left the project. Where he left it is that the grammar accepts it but the interval input routine isn't paying any attention to the qualifier. I'm not eager to rip out what's there, but I don't personally feel like making it work either... regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [HACKERS] Why is this allowed?
Chuck McDevitt [EMAIL PROTECTED] writes: Is fixing this on the TODO list? See the 'Add ISO INTERVAL handling' entry. regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [HACKERS] Why is this allowed?
On Sat, 10 Mar 2007, Chuck McDevitt wrote: Ok... Just to be clear, the ISO SQL spec says that INTERVAL '1' DAY is the correct way to specify a one-day interval. That's why it is surprising that PostgreSQL treats it differently, with no error or warning. The PostgreSQL syntax INTERVAL '1 DAY' is non-standard. Is fixing this on the TODO list? Yes: Add ISO INTERVAL handling There's detail there about the nature of support required. Personally, I think the syntax is awful. I don't understand why intervals are handled so differently in the spec as compared to other data types. This syntax is well supported by Oracle and DB2 though. I guess it should be completed in postgres. Thanks, Gavin ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate