PG::UndefinedFunction - function COUNT() w/ multiple arguments doesn't exist in PG
Opened this issue · 1 comments
brunnopleffken commented
I'm trying to export the data in the following PostgreSQL table as a seed:
As you can see, nothing fancy.
However, I'm getting the error:
bin/rails aborted!
ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR: function count(bigint, character varying, character varying) does not exist (ActiveRecord::StatementInvalid)
LINE 1: SELECT COUNT(id, name, class_entity) FROM "professions"
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Caused by:
PG::UndefinedFunction: ERROR: function count(bigint, character varying, character varying) does not exist (PG::UndefinedFunction)
LINE 1: SELECT COUNT(id, name, class_entity) FROM "professions"
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Tasks: TOP => db:seed:dump
(See full trace by running task with --trace)
Why is seed_dump using COUNT passing multiple columns as arguments in PostgreSQL? This doesn't work.
And this is strange because it's the first time I've seen this error using seed_dump.
brunnopleffken commented
I found out what's going on.
seed_dump is conflicting with the model:
default_scope { select(:id, :name, :class_entity) }
Temporarily commenting this line makes it work.
Shouldn't seed_dump unscope queries?