On Thursday, May 11, 2017 at 9:19:31 AM UTC-7, Matt Campbell wrote:
>
> I want to update the value of one column of a composite type, but I'm 
> getting a syntax error on the sql sequel generates.
>
> DB[:my_table].where(id: 1).update(:complex_column.pg_row[:my_column] => 
> 'my_value')
>
> This results in the following SQL
>
> UPDATE "my_table" SET ("complex_column")."my_column" = 'my_value' WHERE (
> "id" = 1)
>
> Postgres doesn't like the parentheses around complex_column (here's a link 
> to the docs that say this 
> https://www.postgresql.org/docs/9.5/static/rowtypes.html#AEN8116). Is 
> there another way to do this other than using 
> "complex_column.my_column".lit
>
> for the column name in the update call?
>
> ruby version: 2.3.1
> sequel version: 4.44.0
> sequel_pg version: 1.6.17
> pg version: 0.18.4
> PostgreSQL Version 9.5.0
>

It looks like what you want is just a regular qualified identifier:

  Sequel[:complex_column][:my_column]
  # or :complex_column__my_column if you are still splitting symbols

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to