Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lessons/227/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CREATE TABLE product (
jdoc jsonb
);

CREATE INDEX product_inx ON product USING GIN (jdoc);
CREATE INDEX idx__product__price ON product using BTREE(((jdoc -> 'price')::NUMERIC));

INSERT INTO product(jdoc) VALUES ('{"name": "Shampoo", "price": 7.90, "stock": 100}');
INSERT INTO product(jdoc) VALUES ('{"name": "Hairspray", "price": 11.50, "stock": 100}');
Expand Down
2 changes: 1 addition & 1 deletion lessons/227/client/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (p *product) create(pg *postgres, mg *mongodb, db string, m *metrics) (err

if db == "pg" {
b, err := json.Marshal(p)
fail(err, "json.Marshal(p) filaed")
fail(err, "json.Marshal(p) failed")

err = pg.dbpool.QueryRow(pg.context, `INSERT INTO product(jdoc) VALUES ($1) RETURNING id`, b).Scan(&p.PostgresId)

Expand Down
8 changes: 4 additions & 4 deletions lessons/227/migration/0-sql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ data:

COMMIT;

VACUUM full;

-- Create Tables

CREATE TABLE product (
id SERIAL PRIMARY KEY,
jdoc jsonb
);

CREATE INDEX product_inx ON product USING GIN (jdoc);

CREATE INDEX idx__product__price ON product using BTREE(((jdoc -> 'price')::NUMERIC));

VACUUM full;