On Wednesday, July 5, 2017 at 3:13:41 PM UTC-7, John Backus wrote:
>
> I'm upgrade to Sequel 4.48 and I'm getting deprecation warnings for
> `register_row_type`. Currently I have this type:
>
> cognito-dev=# \dT+ encrypted_ssn
> List of data types
> Schema | Name | Internal name | Size | Elements | Owner |
> Access privileges | Description
>
> --------+---------------+---------------+-------+----------+---------+-------------------+-------------
> public | encrypted_ssn | encrypted_ssn | tuple | | cognito |
> |
> (1 row)
>
> CREATE TYPE encrypted_ssn AS (
> ciphertext encrypted_ssn_ciphertext,
> metadata encryption_metadata
> );
>
> right now I just do this with Sequel:
>
> DB.register_row_type(:encrypted_ssn)
>
> I guess this is deprecated now but I'm not clear on how to resolve it
> based on the warning:
>
> SEQUEL DEPRECATION WARNING: Calling conversion proc for subtype (oid:
> 338050) of composite type (oid: 338058) not added until after composite
> type registration is deprecated and will be removed in Sequel 5. Register
> subtype conversion procs before registering composite type.
>
> Do I need to query the pg_type table like Sequel does? I'm not clear on
> what I'm supposed to register, with what public API, etc.
>
You probably want to run:
DB.add_named_conversion_proc(:encrypted_ssn_ciphertext){|s| ...}
DB.add_named_conversion_proc(:encryption_metadata){|s| ...}
DB.register_row_type(:encrypted_ssn)
The deprecation warning should only happen if you were adding the
conversion proc for encrypted_ssn_ciphertext or encryption_metadata after
registering the row type. I'm guessing your current code does something
like:
DB.register_row_type(:encrypted_ssn)
DB.add_named_conversion_proc(:encrypted_ssn_ciphertext){|s| ...}
DB.add_named_conversion_proc(:encryption_metadata){|s| ...}
If that isn't the case and you are sure that the subtype row procs are
already registered when register_row_type is called, or that you weren't
registering conversion procs for the subtypes, I would appreciate if you
could submit a minimal self contained example showing the problem so that I
could debug it.
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.