4 replaced http://dba.stackexchange.com/ with https://dba.stackexchange.com/
source | link

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast("user"->>'reputation' AS int));

The Postgres syntax shortcut :: for casts is not allowed without additional parentheses in an index definition (see @bma's commentsee @bma's comment). It works with the standard SQL function, though: cast(expression AS type) This is not related to the json type per se.

Either way, you can still use the syntax shortcut expression::type in expressions that utilize the index.

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast("user"->>'reputation' AS int));

The Postgres syntax shortcut :: for casts is not allowed without additional parentheses in an index definition (see @bma's comment). It works with the standard SQL function, though: cast(expression AS type) This is not related to the json type per se.

Either way, you can still use the syntax shortcut expression::type in expressions that utilize the index.

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast("user"->>'reputation' AS int));

The Postgres syntax shortcut :: for casts is not allowed without additional parentheses in an index definition (see @bma's comment). It works with the standard SQL function, though: cast(expression AS type) This is not related to the json type per se.

Either way, you can still use the syntax shortcut expression::type in expressions that utilize the index.

3 link to bma
source | link

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast("user"->>'reputation' AS int));

For some reason (unknown to me), theThe Postgres syntax shortcut :: for casts is not allowed without additional parentheses in an index definition (see @bma's comment). It should workworks with the standard SQL formfunction, though: cast(expression AS type), though. This is completely independent ofnot related to the json type, btw per se.

YouEither way, you can still use the syntax shortcut  expression::type in expressions that utilize the index, though.

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast("user"->>'reputation' AS int))

For some reason (unknown to me), the Postgres syntax shortcut :: for casts is not allowed in an index definition. It should work with the standard SQL form cast(expression AS type), though. This is completely independent of the json type, btw.

You can still use the syntax shortcut  expression::type in expressions that utilize the index, though.

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast("user"->>'reputation' AS int));

The Postgres syntax shortcut :: for casts is not allowed without additional parentheses in an index definition (see @bma's comment). It works with the standard SQL function, though: cast(expression AS type) This is not related to the json type per se.

Either way, you can still use the syntax shortcut expression::type in expressions that utilize the index.

2 typo
source | link

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast ("user"->>'reputation' AS int))

For some reason (unknown to me) reason, the Postgres syntax shortcut :: for casts is not allowed in an index definition. It should work with the standard SQL form cast(expression AS type), though. This is completely independent of the json type, btw.

You can still use the syntax shortcut expression::type in expressions that utilize the index, though.

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast ("user"->>'reputation' AS int)

For some (unknown to me) reason, the Postgres syntax shortcut :: for casts is not allowed an index definition. It should work with the standard SQL form cast(expression AS type), though. This is completely independent of the json type, btw.

You can still use the syntax shortcut expression::type in expressions that utilize the index, though.

Try this instead:

CREATE INDEX user_reputation_idx ON users(cast("user"->>'reputation' AS int))

For some reason (unknown to me), the Postgres syntax shortcut :: for casts is not allowed in an index definition. It should work with the standard SQL form cast(expression AS type), though. This is completely independent of the json type, btw.

You can still use the syntax shortcut expression::type in expressions that utilize the index, though.

1
source | link