Complete the code to enable the pg_trgm extension in PostgreSQL.
CREATE EXTENSION IF NOT EXISTS [1];The pg_trgm extension provides functions and operators for determining the similarity of text based on trigram matching.
Complete the code to create a UUID using the uuid-ossp extension.
SELECT [1]() AS new_uuid;The function uuid_generate_v4() creates a random UUID version 4 using the uuid-ossp extension.
Fix the error in the code to store a key-value pair using the hstore extension.
INSERT INTO settings (data) VALUES ([1]('theme', 'dark'));
The hstore function creates a key-value pair for the hstore data type.
Fill both blanks to create a trigram index on the column 'description' in table 'products'.
CREATE INDEX [1] ON products USING [2] (description);
The index name is usually descriptive. The gin index type is used with pg_trgm for trigram indexing.
Fill both blanks to query hstore data for the value of key 'color' in the 'attributes' column.
SELECT attributes[1] 'color' AS color_value, attributes-> 'color' AS hstore_value FROM products WHERE attributes[2] 'color';
The operator ->> extracts the value as text from an hstore column. The -> operator extracts the value as hstore. The ? operator checks if a key exists.