Skip to content

Commit

Permalink
Fix: PG::SyntaxError: Replace 'DISCARD ALL' query to similer operations.
Browse files Browse the repository at this point in the history
* DISCARD` was implemented on PostgreSQL since v8.3
  However, Redshift is based on PostgreSQL 8.0.2

References
* [PostgreSQL DISCARD](https://www.postgresql.org/docs/current/static/sql-discard.html)
* [Amazon Redshift and PostgreSQL](http://docs.aws.amazon.com/redshift/latest/dg/c_redshift-and-postgres-sql.html)
  • Loading branch information
taise committed Jun 9, 2016
1 parent 1b17aa7 commit 92d3ae7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/active_record/connection_adapters/redshift_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ def reset!
unless @connection.transaction_status == ::PG::PQTRANS_IDLE
@connection.query 'ROLLBACK'
end
@connection.query 'DISCARD ALL'
session_auth = 'DEFAULT'
@connection.query 'RESET ALL'
dealloc 'ALL'
@connection.query 'CLOSE ALL'
configure_connection
end

Expand Down

0 comments on commit 92d3ae7

Please sign in to comment.