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
So basically pg-live-query adds id and rev to all the tables (if not already present) and the watching logic relies on the idea that your custom query will only track oneid field (if any, otherwise the one added is the one of the main from table).
Actually this query (the one in the readme) should not work (I tried with a very similar and indeed it did fail with a mesage like "column id is ambiguous"):
SELECT*FROM
users u JOIN
logins l ONl.user_id=u.idWHEREl.date>'2016-01-01'
To get a slightly better understanding look at this part of the code: https://github.com/nothingisdead/pg-live-query/blob/master/watcher.js#L271
Many subsequent call to alias q in this sql query use the id field which does not mean anything if there are multiple of them. And there are multiple of them if your query results in multiple of them.
@nothingisdead, how do you think this could be solved ? I can think of two main solutions, either meta columns are prefixed with their table names (but that would require a bunch of changes in many places in the code) or the meta olumns are aliased in the "magic" query in the watcher but I can't see how that would be possible given an arbitrary sql command (some kind of filter ?).
As long as this remains that way, beware of queries with multiple id columns beeing returned
The text was updated successfully, but these errors were encountered:
So basically pg-live-query adds id and rev to all the tables (if not already present) and the watching logic relies on the idea that your custom query will only track one id field (if any, otherwise the one added is the one of the main from table).
Actually this query (the one in the readme) should not work (I tried with a very similar and indeed it did fail with a mesage like "column id is ambiguous"):
To get a slightly better understanding look at this part of the code:
https://github.com/nothingisdead/pg-live-query/blob/master/watcher.js#L271
Many subsequent call to alias q in this sql query use the id field which does not mean anything if there are multiple of them. And there are multiple of them if your query results in multiple of them.
@nothingisdead, how do you think this could be solved ? I can think of two main solutions, either meta columns are prefixed with their table names (but that would require a bunch of changes in many places in the code) or the meta olumns are aliased in the "magic" query in the watcher but I can't see how that would be possible given an arbitrary sql command (some kind of filter ?).
As long as this remains that way, beware of queries with multiple id columns beeing returned
The text was updated successfully, but these errors were encountered: