[英]Error executing query via CDbCommand
我已經試過這個查詢。
SELECT * FROM(
SELECT DISTINCT ('Kegiatan - ' || coalesce(e.nama,'')) caption, l.id_event id,'e'::text AS berita_type
FROM event e
LEFT JOIN lokasi_pengamatan l ON l.id_event=e.id_event
LEFT JOIN users_location u ON l.id_lokasi_pengamatan=u.id_lokasi_pengamatan
WHERE
1=1
AND l.status = TRUE
AND e.status = TRUE
AND e.e_deleted_at IS NULL
AND l.lp_deleted_at IS NULL
)t1
UNION ALL
SELECT * FROM(
SELECT DISTINCT coalesce(e.nama,'') || ' - ' || coalesce(l.nama,'') caption, l.id_lokasi_pengamatan id, 'lp'::text AS berita_type
FROM event e
LEFT JOIN lokasi_pengamatan l ON l.id_event=e.id_event
LEFT JOIN users_location u ON l.id_lokasi_pengamatan=u.id_lokasi_pengamatan
WHERE
1=1
AND l.status = TRUE
AND e.status = TRUE
AND e.e_deleted_at IS NULL
AND l.lp_deleted_at IS NULL
)t2
ORDER BY berita_type ASC, id DESC, caption ASC
通過Postgre Manager執行時查詢確定,但通過CDbCommand
執行時引發錯誤。
SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block. The SQL statement executed was:
誰知道為什么?
您應該刷新yii數據庫模式緩存:
Yii::app()->cache->flush();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.