List of causes for PG::InvalidChangeOfResultFields exceptions
24 views
Skip to first unread message
mic...@knotch.com
unread,
Dec 3, 2018, 3:34:16 PM12/3/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ruby-pg
I am curious as to what exactly would cause this exception to be raised. We're using a read-only replica and run pretty long running aggregation queries off this replica. These queries are executed via Ruby PG using streaming mode. Occasionally, this exception is raised by our aggregation service but it seems to happen randomly and we haven't been able to reproduce it in a controlled setting.
Any insight into how or why this exception would be raised will be very helpful. Thanks!
Robert Klemme
unread,
Dec 10, 2018, 3:07:39 PM12/10/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rub...@googlegroups.com
On Mon, Dec 3, 2018 at 9:34 PM <mic...@knotch.com> wrote:
>
> I am curious as to what exactly would cause this exception to be raised. We're using a read-only replica and run pretty long running aggregation queries off this replica. These queries are executed via Ruby PG using streaming mode. Occasionally, this exception is raised by our aggregation service but it seems to happen randomly and we haven't been able to reproduce it in a controlled setting.
>
> Any insight into how or why this exception would be raised will be very helpful. Thanks!
This is really just a guess: maybe there is a memory constraint (e.g.
either physical mem lacking, PG's buffer cache not large enough, not
enough work memory configured) so the query cannot be completed
properly. That would explain the randomness (e.g. via parallel
activity that eats memory).
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rub...@googlegroups.com
Thanks for the insight! Very confused by this error overall and any
additional information is helpful and appreciated.
One thing I forgot to mention is that we're using this code in a
multi-threaded process. Is there any chance that could also explain it
and maybe somehow the streams are getting mixed up?
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mic...@knotch.com, ruby-pg
If I remember right, this error happens when prepared statements are outdated. ActiveRecord makes use of prepared statements by default. If you do database migrations, while long running processes are active, these processes will receive this error, when they execute the next query using a now outdated prepared statement.
This can be avoided by disabling prepared statements, leading to somewhat lower performance or by flushing all prepared statements in long running processes, whenever the schema changes.