I am getting complier error "cast arguments to RowN on the set statement.
(set( Tables.MY_TABLE.CUSTOMTYPE, DSL.field("array_remove({0}, {1})",
f.getDataType(), Tables.MY_TABLE.CUSTOMTYPE, f)))
And if cast both the set functions params to RowN then it complies but then
I get runtime error that cannot convert field to row. Can you please
suggest how to use this DSL.field("array_remove({0}, {1})",
f.getDataType(), Tables.MY_TABLE.CUSTOMTYPE, f) in update set method.
Field<CustomTypeRecord> f = DSL.val(new CustomTypeRecord("test3", "-1"));
dslContext.update(Tables.MY_TABLE)
.set( Tables.MY_TABLE.CUSTOMTYPE, DSL.field("array_remove({0}, {1})",
f.getDataType(), Tables.MY_TABLE.CUSTOMTYPE, f))
.where(condition)
.execute();
On Friday, February 3, 2023 at 5:29:29 PM UTC+5:30 [email protected] wrote:
> How exactly is it not working for you? What are you seeing? Runtime
> errors? Wrong results?
>
> On Fri, Feb 3, 2023 at 12:58 PM Pragya Gaur <[email protected]> wrote:
>
>> I meant, I tried below step, but it is not working for me.
>>
>> Field<CustomTypeRecord> f = DSL.val(new CustomTypeRecord("test3", "-1"));
>>
>> dslContext.update()
>> .set( Tables.MY_TABLE.CUSTOMTYPE, DSL.field("array_remove({0}, {1})",
>> f.getDataType(), Tables.MY_TABLE.CUSTOMTYPE, f))
>> .where(condition)
>> .execute();
>> On Friday, February 3, 2023 at 4:30:47 PM UTC+5:30 [email protected]
>> wrote:
>>
>>> Can you please be specific about this "something"?
>>>
>>> On Fri, Feb 3, 2023 at 11:59 AM Pragya Gaur <[email protected]> wrote:
>>>
>>>>
>>>> I am very new to JOOQ. Can you please suggest how to use it in update
>>>> statements. I tried out something like this but not working for me.
>>>>
>>>> Field<CustomTypeRecord> f = DSL.val(new CustomTypeRecord("test3",
>>>> "-1"));
>>>> dslContext.update()
>>>> .set( Tables.MY_TABLE.CUSTOMTYPE,
>>>> DSL.field("array_remove({0}, {1})", f.getDataType(),
>>>> Tables.MY_TABLE.CUSTOMTYPE, f))
>>>> .where(condition)
>>>> .execute();
>>>> On Friday, February 3, 2023 at 2:03:46 PM UTC+5:30 [email protected]
>>>> wrote:
>>>>
>>>>> ARRAY_REMOVE will be supported in the upcoming jOOQ 3.18:
>>>>> https://github.com/jOOQ/jOOQ/issues/11981
>>>>>
>>>>> Until then, you can just use plain SQL templating whenever you need to
>>>>> work with vendor specific functions that aren't supported:
>>>>>
>>>>> https://www.jooq.org/doc/latest/manual/sql-building/plain-sql-templating/
>>>>>
>>>>> Field<CustomTypeRecord> f = DSL.val(new CustomTypeRecord("test3",
>>>>> "-1"));
>>>>> DSL.field("array_remove({0}, {1})", f.getDataType(),
>>>>> MY_TABLE.CUSTOMTYPECOLUMN, f);
>>>>>
>>>>>
>>>>> I hope this helps,
>>>>> Lukas
>>>>>
>>>>> On Fri, Feb 3, 2023 at 9:30 AM Pragya Gaur <[email protected]> wrote:
>>>>>
>>>>>> I have a TYPE defined say customtype and have a table where one of
>>>>>> the columns is customtype[].
>>>>>> I am trying to find ways where I can execute the below sql query in
>>>>>> JOOQ:
>>>>>>
>>>>>> update MY_TABLE SET customtypecolumn = array_remove(customtypecolumn,
>>>>>> ('test3','-1')::customtypecolumn) where <some_condition>
>>>>>>
>>>>>> I tried following this link
>>>>>> https://jooq-user.narkive.com/ScEfUAlX/fastest-way-to-remove-values-from-an-integer-array
>>>>>> But this way I am getting exception TYPE customtype is not supported
>>>>>> in dialect POSTGRES
>>>>>>
>>>>>> --
>>>>>> 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].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/jooq-user/78e86317-41d1-41ed-ba6d-f2060ac3018an%40googlegroups.com
>>>>>>
>>>>>> <https://groups.google.com/d/msgid/jooq-user/78e86317-41d1-41ed-ba6d-f2060ac3018an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> 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].
>>>>
>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jooq-user/2fcbcc56-c404-4b5e-b765-fad5a6757c04n%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/jooq-user/2fcbcc56-c404-4b5e-b765-fad5a6757c04n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>> 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].
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jooq-user/72e9a543-9ac1-4a52-a23f-1853dc9342ben%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jooq-user/72e9a543-9ac1-4a52-a23f-1853dc9342ben%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jooq-user/c3f56a46-18e3-4503-a8b4-a95df394c940n%40googlegroups.com.