I see. Anyway, thank you very much for bringing this to our attention. We should certainly investigate if this can be fixed, as it is confusing when reading the generated SQL. I've created an issue for this: https://github.com/jOOQ/jOOQ/issues/6359
Lukas 2017-06-23 19:15 GMT+02:00 Samir Faci <[email protected]>: > I don't think it has any performance impact, I was simply curious on the > reason for the data type change and redundant casting. > > Or more to the point if there was something silly I was doing that I > shouldn't be. > > > > > On Jun 23, 2017 03:17, "Lukas Eder" <[email protected]> wrote: > >> Hi Samir, >> >> Thanks for your message. First off, it's worth mentioning that this >> happens only when inlining the bind variable. An actual bind variable is >> sent to the JDBC driver in this format: ?::bigint[] >> >> I cannot remember the exact reason off the top of my head for the exposed >> behaviour with inline bind variables, except for the fact that serialising >> non-trivial types to PostgreSQL has been quite a pain in the past, >> specifically when arrays and composite types are combined. Possibly, >> sending array contents as strings may have been the most pragmatic way >> forward that works for all types. >> >> If you feel this behaviour impairs your production performance, etc., >> feel free to open an issue on GitHub with some details and I'll be more >> than happy to revisit the serialisation for some "more trivial" array >> types, like bigint[]. >> >> Hope this helps, >> Lukas >> >> 2017-06-22 20:31 GMT+02:00 Samir Faci <[email protected]>: >> >>> This is the Postgres definition of my method. >>> >>> CREATE OR REPLACE FUNCTION ui.migrate_advertisers( >>> newadvertiser bigint, >>> childrenadvertisers bigint[]) >>> RETURNS void >>> LANGUAGE 'plpgsql' >>> COST 100.0 >>> VOLATILE AS $function$ >>> >>> .... sql code here >>> >>> $function$; >>> >>> >>> >>> When I invoke it from Java via: >>> >>> public void migrationAdvertisers(long targetAdvertiser, Long[] >>> advertisersToBeMigrated) { >>> >>> Routines.migrateAdvertisers(dslContext.configuration(), >>> targetAdvertiser, advertisersToBeMigrated); >>> } >>> >>> >>> >>> But the code that is generated is this: >>> >>> select * from ui.migrate_advertisers(newadvertiser := 3303, >>> childrenadvertisers := >>> cast('{"11533","11545","11548","11553","4225","11558"}' >>> as bigint[])) >>> >>> I'm wondering why Jooq converts the Long to strings when invoked. I >>> would expect it to call. >>> >>> select ui.migrate_advertisers(3303, '{11533,11545,11548,11553,4225,11558}'); >>> >>> >>> -- >>> Thank you >>> Samir Faci >>> https://keybase.io/csgeek >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "jOOQ User Group" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
