kekshd / keks

an elearning system with basic answer types yes/no/matrix
http://keks.uni-hd.de
ISC License
10 stars 4 forks source link

Question.duplicate_question does not work with PostgreSQL #136

Open fosterfarrell9 opened 6 years ago

fosterfarrell9 commented 6 years ago

The Question.duplicate_question method works fine with SQLite, but it does not work with PostgreSQL (which is used in production):

join questions as q2 on q.text = q2.text and q.text is not null and                                                                                                                                                                                                           
 q2.text is not null and q.id < q2.id group by q2.id order by q.id

ActiveRecord::StatementInvalid: PG::GroupingError: ERROR:  column "q.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 3: ...xt is not null and q.id < q2.id group by q2.id order by q.id                                                

The same holds for Question.duplicate_question_and_answers.