このクエリを試しました。
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:
誰かが理由を知っていますか?