I've created some views in postgresql and some of the column names are showing up as capitalized in Metabase - when I create a question I get the following error:
org.postgresql.util.PSQLException: ERROR: column rfq_views.Dimensions does not exist Hint: Perhaps you meant to reference the column "rfq_views.dimensions". Position: 124
I can bypass the error by hiding the column but there are multiple columns with the same issue and I would love to know what might be causing it.
I have several views with the same columns and it is only this view that has the problem. Any suggestions for how to get Metabase to use the correct column name?
(View sql)
SELECT
rlip.id as line_item_id,
COALESCE(r.reference, 'RFQ-' || r.id + 10000) as rfq_number,
r.created_at::timestamp(0) as rfq_created_at,
r.priced_at::timestamp(0) as rfq_priced_at,
r.status,
s.name as supplier_name,
li.shape,
li.material,
li.grade,
li.finish,
li.dimensions_archive as dimensions,
li.length,
li.width,
li.height,
li.diameter,
li.weight,
li.thickness,
li.standard_dimensions,
li.quantity,
ROUND(rlip.unit_price_pennies::numeric(11, 2) / 100, 2) as unit_price,
ROUND(rlip.total_pennies::numeric(11, 2) / 100, 2) as total_price,
ROUND(r.total_gross_pennies::numeric(11, 2) / 100, 2) as rfq_total_gross_price,
li.unit_weight,
li.total_weight,
r.total_weight as rfq_total_weight,
ROUND((rlip.total_pennies::numeric(11, 2) / 100) / NULLIF((li.total_weight / 1000), 0), 2) as price_per_tonne,
COALESCE(e.reference, 'EST-' || e.id + 10000) as enquiry_number,
e.enquiry_channel,
e.pricing_test,
b.name as buyer_name,
da.post_code as delivery_postcode,
('QO-' || lpad(q.id::text, 5, '0')) as quote_number,
(qlip.rfq_line_item_price_id = rlip.id) as chosen_for_quote,
(q.status = 'accepted') as accepted_by_buyer,
q.accepted_at::timestamp(0) as quote_accepted_at,
ROUND(qlip.total_pennies::numeric(20, 2) / 100, 2) as quoted_item_total,
r.regret_reasons
FROM
rfqs r
JOIN suppliers s ON s.id = r.supplier_id
JOIN enquiries e ON e.id = r.enquiry_id
JOIN buyers b ON b.id = e.buyer_id
JOIN addresses da ON da.id = e.delivery_address_id
JOIN line_item_prices rlip ON rlip.priced_type = 'Rfq'
AND rlip.priced_id = r.id
JOIN line_items li ON li.id = rlip.enquiry_line_item_id
LEFT JOIN line_item_prices qlip ON qlip.priced_type = 'Quote'
AND qlip.enquiry_line_item_id = li.id
LEFT JOIN quotes q ON q.id = e.quote_id