emails (payload, template_id)
VALUES
(json_build_object('firstName', firstName, 'recipient', 'igor@gmail.com', 'orderId', 1, 'image', image,
'title', title, 'date', date, 'show', show, 'venue', venue, 'address', address, 'city', city,
'province', province, 'zip', zip, 'tickets', tickets)::JSONB, 3);
(SELECT
o.name AS "firstName", o.surname AS "lastName",
e.cropped_image_thumb AS image, e.name AS title,
e.venue_name AS venue, e.venue_address AS address,
e.venue_city AS city, e.venue_state AS province,
e.zip AS zip,
s.start_date AS date, t.showtime AS show,
json_agg(json_build_object('secret', t.secret, 'sequence', format('T%s', t.id), 'title', b.book_title,
'payload', format('{vendor: "seatgeek.com", ticket: "T%s", secret: "%s"}',
t.id, t.secret)))::JSONB AS tickets
FROM
purchase o, event e, event_shows s, ticket t, ticket_books b
WHERE
t.order_id = o.id AND
b.id = t.book_id AND
t.show_id = s.id AND
event.id = s.event_id AND
o.id = 1
GROUP BY
o.name, o.surname, e.cropped_image_thumb, e.name, e.venue_name,
e.venue_address, e.venue_city, e.venue_state, e.zip, s.start_date,
t.showtime)
почему оно ругается?
ERROR: column "firstName" does not exist
LINE 4: (json_build_object('firstName', "firstName", 'reci...
Потому что и должно? Не выдумывайте [несуществующий] синтаксис, прочитайте документацию (я не понимаю, что Вам конкретно нужно, поэтому не подскажу).
Обсуждают сегодня