You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In pg versions prior to 8.11.4, selecting multiple columns with the same name would produce a non-null result if any of the columns were not null. Starting with 8.11.4, query() returns the right-most column of the same name, even if it's null. This is arguably the correct behavior, but it caused a breakage in my application due to a select * outer join query that had multiple columns of the same name from different tables, where some were null and others not.
const{ Client }=require('pg')asyncfunctionmain(){constclient=newClient()awaitclient.connect()constx='Hello, world'constres=awaitclient.query(`SELECT $1::text as msg, null as msg`,[x])console.dir(res.rows)awaitclient.end()}main()
In
pg
versions prior to 8.11.4, selecting multiple columns with the same name would produce a non-null result if any of the columns were not null. Starting with 8.11.4,query()
returns the right-most column of the same name, even if it's null. This is arguably the correct behavior, but it caused a breakage in my application due to aselect *
outer join query that had multiple columns of the same name from different tables, where some were null and others not.This appears to have been introduced in da0f5c5.
Reproduction script:
8.11.3:
8.11.4:
8.11.5:
The text was updated successfully, but these errors were encountered: