SCassidy@overlandstorage.com wrote:
> A "PostgreSQL to Oracle converter" might be a really big project.
>
> Having ported an application from PostgreSQL (7.3) to Oracle 9i, as I
> recall, my biggest problems were:
>
> - Quoting issues: the original PostgreSQL application quoted
> integer/numeric type, and Oracle will not allow that, so I had to make sure
> only types that had to be quoted, were. (I normally do not quote numbers
> in PostgreSQL, but I inherited the application).
What does the standard say about that? Which types of values in Oracle
need to not be quoted?
Regards,
Jeff Davis
Re: [GENERAL] Oracle buys Innobase
От:
Jan Wieck <JanWieck@Yahoo.com>
Дата:
On 10/21/2005 1:58 AM, Jeff Davis wrote:
> SCassidy@overlandstorage.com wrote:
>> A "PostgreSQL to Oracle converter" might be a really big project.
>>
>> Having ported an application from PostgreSQL (7.3) to Oracle 9i, as I
>> recall, my biggest problems were:
>>
>> - Quoting issues: the original PostgreSQL application quoted
>> integer/numeric type, and Oracle will not allow that, so I had to make sure
>> only types that had to be quoted, were. (I normally do not quote numbers
>> in PostgreSQL, but I inherited the application).
>
> What does the standard say about that? Which types of values in Oracle
> need to not be quoted?
Section 5.3 of SQL92 defines:
::=
|
::=
|
::=
|
|
|
|
|
The Restrictions for Entry level SQL say that
a) A shall not be a .
b) A shall not be a or
.
There are no restrictions that say a cannot be a
. is defined without quotes, but from
the above I conclude that a is allowed instead of a
to represent a numeric value, which means Oracle is
wrong IMNSVHO.
No reason to swell your breast though, we aren't perfect in the literal
area either. Because
::=
|
Re: [GENERAL] Oracle buys Innobase
От:
Jonathan Gennick <jgennick@oreilly.com>
Дата:
21 октября 2005 г. в 12:40:34
I hope it's ok if I jump in here. I am having a difficult time
following Jan's logic:
JW> The Restrictions for Entry level SQL say that
JW> a) A shall not be a literal>.
JW> b) A shall not be a or
JW> .
JW> There are no restrictions that say a cannot be a
JW> .
I just took a look at my copy of SQL:2003, and I do agree that there
is no rule per se stating that "a " cannot be a ". However, I also find nothing to indicate that a *can* be a . Looking at the definition for
, I see:
::=
|
|
|
|
|
|
I see seven possible manifestations of a general literal (, , and so forth). None of these
manifestations has to do with numeric values.
I see numeric literals defined as follows:
::= [ ]
::=
|
And, digging down further, I see no quotes anywhere in the
definitions.
From all that I have seen so far in the standard, if you write a
literal such as, say, '23.5', what you have is a character string. I
see no ambiguity on that point.
Now, Oracle (and possibly other databases) will allow you to use a
character string when a number is called for. For example:
SELECT some_number + '23.5' from some_table;
In such cases, Oracle implicitly converts the character string, but
implicit conversion is potentially a can of worms and I don't think
it's really the issue you are talking about, is it?
Interestingly, DB2 is rather hard-nosed about implicit conversions. I
would have to test again to be certain, but I don't believe DB2 would
implicitly convert '23.5' to a number in the above context.
Pardon me if I've missed the boat somewhere, or misunderstood the
issue, but I don't at the moment see where you can put quotes around
digits and still have a numeric literal. I believe the quotes give you
a character string.
Best regards,
Jonathan Gennick
Editor, O'Reilly Media
906.387.1698 mailto:jgennick@oreilly.com
Friday, October 21, 2005, 10:29:43 AM, Jan Wieck (JanWieck@Yahoo.com) wrote:
JW> On 10/21/2005 1:58 AM, Jeff Davis wrote:
>> SCassidy@overlandstorage.com wrote:
>>> A "PostgreSQL to Oracle converter" might be a really big project.
>>>
>>> Having ported an application from PostgreSQL (7.3) to Oracle 9i, as I
>>> recall, my biggest problems were:
>>>
>>> - Quoting issues: the original PostgreSQL application quoted
>>> integer/numeric type, and Oracle will not allow that, so I had to make sure
>>> only types that had to be quoted, were. (I normally do not quote numbers
>>> in PostgreSQL, but I inherited the application).
>>
>> What does the standard say about that? Which types of values in Oracle
>> need to not be quoted?
JW> Section 5.3 of SQL92 defines:
JW> ::=
JW>
JW> |
JW> ::=
JW>
JW> |
JW> ::=
JW>
JW> |
JW> |
JW> |
JW> |
JW> |
JW> The Restrictions for Entry level SQL say that
JW> a) A shall not be a literal>.
JW> b) A shall not be a or
JW> .
JW> There are no restrictions that say a cannot be a
JW> . is defined without quotes, but from
JW> the above I conclude that a is allowed instead of a
JW> to represent a numeric value, which means Oracle is
JW> wrong IMNSVHO.
JW> No reason to swell your breast though, we aren't perfect in the literal
JW> area either. Because
JW> ::=
JW>
JW> |
JW> |
JW> ::=
JW> DATE
JW> ::=
JW> TIME
JW> ::=
JW> TIMESTAMP
JW> ::=
JW>
JW> ...
JW> We allow a to be used as a or
JW> without the keyword DATE, TIME, TIMESTAMP or
JW> INTERVAL. Isn't that violating the restrictions for Entry level SQL?
JW> Further
JW> 1) In a or literal>, the sequence:
JW> ...
JW> ... ...
JW> is equivalent to the sequence
JW> ... representation>...
JW> Note: The s in the equivalent se-
JW> quence are in the same sequence and relative sequence as in the
JW> original .
JW> The rule is more or less repeated for other literal types. But 8.0.4 claims
JW> wieck=# select 'foo ' 'bar';
JW> ERROR: syntax error at or near "'bar'" at character 15
JW> LINE 1: select 'foo ' 'bar';
JW> ^
JW> I guess neither Oracle nor we get the cookie here.
JW> Jan
>>
>> Regards,
>> Jeff Davis
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 9: In versions below 8.0, the planner will ignore your desire to
>> choose an index scan if your joining column's datatypes do not
>> match
Re: [GENERAL] Oracle buys Innobase
От:
Jeff Davis <jdavis-pgsql@empires.org>
Дата:
21 октября 2005 г. в 15:30:31
Jan Wieck wrote:
> On 10/21/2005 1:58 AM, Jeff Davis wrote:
>
>> SCassidy@overlandstorage.com wrote:
>>
>>> A "PostgreSQL to Oracle converter" might be a really big project.
>>>
>>> Having ported an application from PostgreSQL (7.3) to Oracle 9i, as I
>>> recall, my biggest problems were:
>>>
>>> - Quoting issues: the original PostgreSQL application quoted
>>> integer/numeric type, and Oracle will not allow that, so I had to
>>> make sure
>>> only types that had to be quoted, were. (I normally do not quote
>>> numbers
>>> in PostgreSQL, but I inherited the application).
>>
>>
>> What does the standard say about that? Which types of values in Oracle
>> need to not be quoted?
>
>
> Section 5.3 of SQL92 defines:
>
> ::=
>
> |
>
> ::=
>
> |
>
> ::=
>
> |
> |
> |
> |
> |
>
> The Restrictions for Entry level SQL say that
>
> a) A shall not be a literal>.
>
> b) A shall not be a or
> .
>
> There are no restrictions that say a cannot be a
> . is defined without quotes, but from
> the above I conclude that a is allowed instead of a
> to represent a numeric value, which means Oracle is
> wrong IMNSVHO.
>
Interesting.
> No reason to swell your breast though, we aren't perfect in the literal
> area either. Because
>
> ::=
>
> |
> |
>
> ::=
> DATE
>
> ::=
> TIME
>
> ::=
> TIMESTAMP
>
> ::=
>
>
> ...
>
> We allow a to be used as a or
> without the keyword DATE, TIME, TIMESTAMP or
> INTERVAL. Isn't that violating the restrictions for Entry level SQL?
>
> Further
>
> 1) In a or literal>, the sequence:
>
> ...
> ... ...
>
> is equivalent to the sequence
>
> ... representation>...
>
> Note: The s in the equivalent se-
> quence are in the same sequence and relative sequence as in the
> original .
>
> The rule is more or less repeated for other literal types. But 8.0.4 claims
>
> wieck=# select 'foo ' 'bar';
> ERROR: syntax error at or near "'bar'" at character 15
> LINE 1: select 'foo ' 'bar';
> ^
>
> I guess neither Oracle nor we get the cookie here.
>
From docs 4.1.2.1:
--------------------------
Two string constants that are only separated by whitespace with at
least one newline are concatenated and effectively treated as if the
string had been written in one constant. For example:
SELECT 'foo'
'bar';
is equivalent to
SELECT 'foobar';
but
SELECT 'foo' 'bar';
is not valid syntax. (This slightly bizarre behavior is specified by
SQL; PostgreSQL is following the standard.)
--------------------------
Is that what you're talking about? Is that section incorrect, or did I
misunderstand you?
Regards,
Jeff Davis