Skip to content

Pg Query Dependency Issue (maybe?) #9

@bradrobertson

Description

@bradrobertson

Attempting to run this: PgColumnBytePacker::PgDump.sort_columns_for_definition_file( Rails.root.join('db', 'structure.sql').to_s, connection: ActiveRecord::Base.connection) yields this error:

TypeError: wrong argument type Integer (expected String)
from /opt/homebrew/lib/ruby/gems/2.6.0/gems/pg_column_byte_packer-1.1.0/lib/pg_column_byte_packer/pg_dump.rb:74:in `[]'

The line in question that fails is:

if parsed && (column_def = parsed.tree[0]["RawStmt"]["stmt"]["CreateStmt"]["tableElts"][0]["ColumnDef"])

And parsed is defined as PgQuery.parse(fake_query).

This is just a guess, but judging by the release dates of this gem, I'd assume it was working on PgQuery 1.2, but the latest PgQuery is now 2.1 which I can only guess has changed the interface quite a bit. Since this gem doesn't lock down PgQuery to any version, I'm assuming it's now broken by default.

Is anyone else seeing this?

I'm on OSX 11.4 on Apple M1, running against PG12 with ruby 2.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions