1
votes

I'm trying to find the name for these type of indexes. I looked on Google and Postgres documentation and they have nothing on what Value-> operator does. And how its different from a regular: -> SomeInt.

CREATE INDEX "someIndex" ON "me-db"."someTable" USING btree ((((jsondata -> 'SomeInt'::text) -> 'HasValue'::text)))
CREATE INDEX "someIndex2" ON "me-db"."someTable" USING btree ((((jsondata -> 'SomeInt'::text) -> 'Value'::text)))

What are the names for ->HasValue and ->Value operators? How is ->Value different from ->Field.

2

2 Answers

1
votes

These are the key names in you json structure. If you wrap one with another it means you have a nested json like this (for the above lines):

{"SomeInt": {"HasValue": 1, "Value": 2}}

0
votes

Those are called expressional or (more commonly but less correctly) functional indexes.

You are not using ->Value, you are using ->'Value'. Those are different things. The fist would be looking for a column named "value", and using its contents as the name of the key to look for. The second uses the literal string 'Value' as the name of the key to look for.