Re: Oracle Freakishness
"David E. Wheeler" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.general |
|---|---|
| Message-ID | <[email protected]> |
On May 5, 2013, at 5:02 PM, David E. Wheeler <[email protected]> wrote: > No, I get the same error if I cast it to a varray. What’s bizarre is that Oracle says that the error is on the join to tags, not the collect. Here’s another example (with the cast): > > ORA-00942: table or view does not exist (DBD ERROR: error possibly near <*> indicator at char 419 in ' > SELECT c.change_id AS id, c.change AS name, c.project, c.note, > to_char(c.planned_at AT TIME ZONE 'UTC', '"year":YYYY:"month":MM:"day":DD') || to_char(c.planned_at AT TIME ZONE 'UTC', ':"hour":HH24:"minute":MI:"second":SS:"time_zone":"UTC"') AS timestamp, c.planner_name, c.planner_email, > cast(COLLECT(t.tag) AS sqitch_array) AS tags > FROM changes c > LEFT JOIN <*>tags t ON c.change_id = t.change_id > WHERE c.project = :p1 > GROUP BY c.change_id, c.change, c.project, c.note, c.planned_at, > c.planner_name, c.planner_email, c.committed_at > ORDER BY c.committed_at ASC > ') For the archives, I finally got a fix for this, thanks to some digging by a user. Turns out the problem was that COLLECT() needs the *collected* value to be cast to a specific type. The fix is to change this: cast(COLLECT(t.tag) AS sqitch_array) AS tags To this: CAST(COLLECT(cast(t.tag as varchar2(512))) AS sqitch_array) AS tags Crazy, right? Thanks, David
signature.asc
(application/pgp-signature, 842 B)
-----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJTjLuFAAoJEJLfYnT4yIHxej8QAIQi1TxcYhXwiWoZbXnE6NDN Dv485UZJSUYeuT0o2PRvTYh6TJDfo1yNYadRcyNcODaEDmjSYl23zjRtTyz9LUEp pMIQNceNc0Vo0mK0MzP/TEdPIlL5peDc6ucFS0RdhZ5KH5Pp5i8ri433iZGlILng Kk/wJU+bDvOx5bPrwH7vBgHDLBzmjTpfOFmm4ARSa1FCWdf5Wz5f7Xy7hBEKcZep /c2CgGyLr0qk0fKw7vTREewGo6rbCr5018MNb8ZudkmTYrFBiuC97eJ5M5lzVaSD vXDukmx1G0IU8Pi8eZHKTybXdPaZWiizNhhJzBn0uMyL5NL/EkRIKKDfqs00tvaW VVpYmArw6j9RNNM7KZD4PBJ+tAoM9G7DKoICWqr4TvrxXG24JAOd8sWYyyXf0joK 1zkotxzZdfE7+R8i56U89zcYeMKxT9ih/U4voPO+opBfQyMHy1clA3KkSGi/wWhb GGP8NfM3R9VMdRt6AkM/kyP8P4juU619JWRTUcVPwtPAGJUtN7l2uuonag1uvpwr Yo6t2a+II79BT/MHtwSpsPXjvdlz9fwBJhtBjtmeZEYgQRpUgPg2yunj6CGLLA8L AFIyG/XjXii22DLrioLJTt7u+1LPW2wAReO2uzEEfxZHrJrcdR4ur5TbZQvKdyf6 4DFSno48rznm6aeeiKIo =knKq -----END PGP SIGNATURE-----