On Tuesday, July 24, 2018 at 5:26:56 PM UTC-6, Jeremy Evans wrote:
>
> On Tuesday, July 24, 2018 at 2:36:29 PM UTC-7, James wrote:
>>
>> Hi,
>>
>> I'm not very familiar with PostgreSQL, so I'm not sure if this is a bug
>> or not. I'm trying to copy an SQLite database to PostgreSQL, but I'm
>> getting an error:
>>
>> Error: Sequel::DatabaseError: PG::DuplicateColumn: ERROR: column "0.0"
>> specified more than once
>>
>> Looking at the SQL, it appears there are some unnamed numeric columns
>> being added before any Decimal/Numeric columns:
>>
>> CREATE TABLE "items" ("id" integer GENERATED BY DEFAULT AS IDENTITY
>> PRIMARY KEY, "product_id" integer, "part_number" varchar(34) NOT NULL,
>> "note" text, "option1" varchar(255), "option2" varchar(255), "option3"
>> varchar(255), "0.0" numeric, "price1" numeric DEFAULT NULL NOT NULL,
>> "0.0" numeric, "price2" numeric DEFAULT NULL NOT NULL ...<snip>
>>
>> Changing the column type to Float appears to get rid of these "0.0"
>> numeric column definitions.
>>
>
> Weird, it looks like the column names are being cast to float and then to
> string. I haven't seen that before and nobody else has reported it. Any
> chance you could put together a minimal self-contained reproducible example
> that I can test?
>
I created an empty project, copied some of the schema dumped using sequel
-d:
Sequel.migration do
change do
create_table(:items) do
primary_key :id
Integer :product_id
String :part_number, :size=>34, :null=>false
BigDecimal :price, :default=>BigDecimal("0.0"), :null=>false
BigDecimal :weight, :default=>BigDecimal("0.0"), :null=>false
BigDecimal :length, :default=>BigDecimal("0.0"), :null=>false
BigDecimal :width, :default=>BigDecimal("0.0"), :null=>false
BigDecimal :height, :default=>BigDecimal("0.0"), :null=>false
end
end
end
Ran sequel -m db/migrate/ sqlite://db/test.sqlite3 and got the following
error:
Error: Sequel::DatabaseError: SQLite3::SQLException: duplicate column name:
0.0
/home/james/.gem/ruby/2.5.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in
`initialize'
Changing the default values to 0.0 allows the migration to run
successfully. Not sure if this is enough to get you going? When I use the
sequel -c command to copy the database, I imagine Sequel is generating the
same default values of BigDecimal("0.0").
Thanks,
James
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.