On Tue, Dec 01, 2026 at 00:44:24 -0500,
 Tom Lane <[email protected]> wrote:
Bruno Wolff III <[email protected]> writes:
I expected the final result to be text. The part that surprised me is
the function converting the intermediate steps to text and json, instead
of keeping everything jsonb until the last step.

I might be misunderstanding, but I think you want to use -> not ->>
in these constraints and indexes.  However, both of those operators
take a right-hand argument of type text to specify the key name,
so the 'foo'::text constants that you are seeing in the decompiled
expressions are expected either way.  Those don't tell anything
about what the output type of the expression is.

Thanks. David G. Johnston also pointed out I was misunderstanding the priority of the :: operator. I wasn't expecting he literals to be explicitly typed in the function, but probably should have.

I'm just starting to play with json types in Postgres, so it's possible I made bad choices on he indices.

One is just supposed to let me know if an order number ever gets repeated.

Another is for hypothetical queries for finding which order corresponds to a specific deployed cert based on issuer and serial number. Currently we don't have a very high ratio of orders to deployed certs, where an index would likely help joining the full list of scanned certs.

The last one is to help with generic jsonb searches. But so far I haven't done any. This project was spurred on by wanting to get some information about contacts for certs, but it turned out, the info we wanted isn't in the API data at this time.

This is kind of doubling as a learning project. I had something similar for our previous cert provider. They had a simpler structure, and their API wasn't changing a lot, so I just plucked out the fields we wanted. I'm thinking in this case, keeping stuff in json will make it easier to adjust to changes in the returned data.

Anyway, thanks for your help.


Reply via email to