diff --git a/lib/pg_query/deparse.rb b/lib/pg_query/deparse.rb index 0fcfbfa7..b30a4715 100644 --- a/lib/pg_query/deparse.rb +++ b/lib/pg_query/deparse.rb @@ -150,6 +150,8 @@ def deparse_item(item, context = nil) # rubocop:disable Metrics/CyclomaticComple end when INTEGER node['ival'].to_s + when FLOAT + node['str'] else fail format("Can't deparse: %s: %s", type, node.inspect) end diff --git a/spec/lib/pg_query/deparse_spec.rb b/spec/lib/pg_query/deparse_spec.rb index 1f7db3a1..071331b5 100644 --- a/spec/lib/pg_query/deparse_spec.rb +++ b/spec/lib/pg_query/deparse_spec.rb @@ -221,6 +221,11 @@ let(:query) { 'SELECT * FROM "x" OFFSET 50' } it { is_expected.to eq query } end + + context 'FLOAT' do + let(:query) { 'SELECT "amount" * 0.5' } + it { is_expected.to eq query } + end end context 'type cast' do