Install error : Protocol violation with postgresql

(bussiere) #1

Hi i’ve got a bug trying to make my own docker.

Here are my versions :

discourse@057b1d5b9339:~/discourse$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
discourse@057b1d5b9339:~/discourse$ rails -v
Rails 4.2.4
discourse@057b1d5b9339:~/discourse$ psql --version
psql (PostgreSQL) 9.3.10
discourse@057b1d5b9339:~/discourse$ sudo -u postgres psql postgres
psql (9.3.10)
Type "help" for help.

postgres=# \dx
                           List of installed extensions
  Name   | Version |   Schema   |                   Description                    
 hstore  | 1.2     | public     | data type for storing sets of (key, value) pairs
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(2 rows)

Here is the error :

== Seed from /home/discourse/discourse/db/fixtures/999_topics.rb

== Seed from /home/discourse/discourse/db/fixtures/001_categories.rb
Seeding uncategorized category!

== Seed from /home/discourse/discourse/db/fixtures/002_groups.rb
rake aborted!
ActiveRecord::StatementInvalid: PG::ProtocolViolation: ERROR:  bind message supplies 1 parameters, but prepared statement "a1" requires 0
: SELECT  "groups".* FROM "groups" WHERE "groups"."id" = 0 LIMIT 1
/home/discourse/discourse/app/models/group.rb:194:in `lookup_group'
/home/discourse/discourse/app/models/group.rb:162:in `block in ensure_automatic_groups!'
/home/discourse/discourse/app/models/group.rb:161:in `each_key'
/home/discourse/discourse/app/models/group.rb:161:in `ensure_automatic_groups!'
(eval):1:in `block (2 levels) in run_file'
PG::ProtocolViolation: ERROR:  bind message supplies 1 parameters, but prepared statement "a1" requires 0
/home/discourse/discourse/app/models/group.rb:194:in `lookup_group'
/home/discourse/discourse/app/models/group.rb:162:in `block in ensure_automatic_groups!'
/home/discourse/discourse/app/models/group.rb:161:in `each_key'
/home/discourse/discourse/app/models/group.rb:161:in `ensure_automatic_groups!'
(eval):1:in `block (2 levels) in run_file'
Tasks: TOP => db:seed_fu
(See full trace by running task with --trace)


Install error : Protocol violation
(Sam Saffron) #2

Are you using our docker install, this is an issue with prepared statements we recently disabled

(bussiere) #4

Nope i’ve tried to make my own docker installation (for educationnal purpose and separate the database in an other docker).

The discourse version is the latest from github.

May i ask how to fix it please ?

Regards and thanks

(Jeff Atwood) #5

We do not support installs like this due to lack of time and staff. Sorry.

The only officials supported install is our Docker based install.

(Axel Naumann) #6


I got the same with 2c4f290786f7faa7fefda08d388b2d3eb392d1ec of the master, setting up a dev install as per Beginners Guide to Install Discourse on Ubuntu for Development

It worked with the master from a month ago - but that didn’t import any users because of PR #3823 FIX: phpBB3 importer failed to import users by gschlager · Pull Request #3823 · discourse/discourse · GitHub

Any hints on how to debug this?

Cheers, Axel.

(Sam Saffron) #7

make sure you did not muck with config/database.yml if you did, make sure prepared_statements is false there.

(Axel Naumann) #8

Thanks, Sam!

Nope, that file is not modified:

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	modified:   script/import_scripts/phpbb3/database/database.rb
	modified:   script/import_scripts/phpbb3/database/database_3_1.rb
	modified:   script/import_scripts/phpbb3/settings.yml
	modified:   script/import_scripts/phpbb3/support/settings.rb

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   Gemfile
	modified:   Gemfile.lock

$ git diff Gemfile
diff --git a/Gemfile b/Gemfile
index 92c81e1..afeff76 100644
--- a/Gemfile
+++ b/Gemfile
@@ -182,3 +182,5 @@ group :profile do
   # if you need to profile, uncomment out this line
   # gem 'rack-perftools_profiler', require: 'rack/perftools_profiler', platform: :mri_19
+gem 'mysql2'
+gem 'ruby-bbcode-to-md', path: '/tmp/ruby-bbcode-to-md'

I need the modifications to import from phpBB from a non-standard database port. As I said, that worked before - and it shouldn’t affect the setup, right?

I really appreciate your help!

Cheers, Axel.

(Adrian D'atri Guiran) #9

I have the exact same issue. I realize you only support docker installs, but i’m trying to migrate from phpbb3, so i am following this guide: Importing from phpBB3 Which says to use a non-docker development install.

EDIT: ok nevermind it was fixed by @sam’s advice, i added this line to the database.yml file in the test block

  prepared_statements: false

This line is not there by default.

(Axel Naumann) #10

Indeed, adding that line to the test section did it! Thanks to both of you!


I just solved this problem the same way - is there a reason this isn’t included in the test section by default? seems like an easy fix.

(Axel Naumann) #12

For the record: I have created Make PgSQL happy: ActiveRecord::StatementInvalid: PG::ProtocolViolation by Axel-Naumann · Pull Request #4125 · discourse/discourse · GitHub suggesting this change. I have no knowledge of the consequences of the patch; it might be rejected because it’s obviously bogus.