Seeing Postgres errors (plpgsql already exists/function array_accum already exists) in Rails app log

StackOverflow https://stackoverflow.com/questions/886459

Question

I am constantly seeing the following postgres errors/warnings in my Rails development log. It's not causing my app to fail (I hope). Any idea what could be causing them? What can I do to debug this?

Installed in my PC: - Ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- Rails 2.2.2
- PostgreSQL 8.3.7

  [4;36;1mSQL (0.1ms)[0m   [0;1mSET client_min_messages TO 'panic'[0m
  [4;35;1mSQL (0.1ms)[0m   [0mSET client_min_messages TO 'notice'[0m
  [4;36;1mSQL (0.7ms)[0m   [0;1mSELECT version FROM schema_migrations[0m
DEPRECATION WARNING: ActionMailer::Base.register_template_extension has been deprecated.Use ActionView::Base.register_template_extension instead. (called from /home/gsmendoza/workspace/idea/georgemendoza/config/environment.rb:104)
  [4;35;1mSQL (0.2ms)[0m   [0mbegin[0m
  [4;36;1mSQL (0.1ms)[0m   [0;1msavepoint ts[0m
  [4;35;1mSQL (0.0ms)[0m   [0mPGError: ERROR: function "array_accum" already exists with same argument types
: CREATE AGGREGATE array_accum (anyelement)
 (
 sfunc = array_append,
 stype = anyarray,
 initcond = '{}'
 );
[0m
  [4;36;1mSQL (0.1ms)[0m   [0;1mrollback to savepoint ts[0m
  [4;35;1mSQL (0.1ms)[0m   [0mrelease savepoint ts[0m
  [4;36;1mSQL (0.1ms)[0m   [0;1mcommit[0m
  [4;35;1mSQL (0.1ms)[0m   [0mbegin[0m
  [4;36;1mSQL (0.1ms)[0m   [0;1msavepoint ts[0m
  [4;35;1mSQL (0.0ms)[0m   [0mPGError: ERROR: language "plpgsql" already exists
: CREATE LANGUAGE 'plpgsql';[0m
  [4;36;1mSQL (0.1ms)[0m   [0;1mrollback to savepoint ts[0m
  [4;35;1mSQL (0.1ms)[0m   [0mrelease savepoint ts[0m
  [4;36;1mSQL (0.1ms)[0m   [0;1mcommit[0m
  [4;35;1mSQL (0.1ms)[0m   [0mbegin[0m
  [4;36;1mSQL (0.1ms)[0m   [0;1msavepoint ts[0m
  [4;35;1mSQL (2.6ms)[0m   [0m CREATE OR REPLACE FUNCTION crc32(word text)
 RETURNS bigint AS $$
 DECLARE tmp bigint;
 DECLARE i int;
 DECLARE j int;
 DECLARE word_array bytea;
 BEGIN
 i = 0;
 tmp = 4294967295;
 word_array = decode(replace(word, E'\\', E'\\\\'), 'escape');
 LOOP
 tmp = (tmp # get_byte(word_array, i))::bigint;
 i = i + 1;
 j = 0;
 LOOP
 tmp = ((tmp >> 1) # (3988292384 * (tmp & 1)))::bigint;
 j = j + 1;
 IF j >= 8 THEN
 EXIT;
 END IF;
 END LOOP;
 IF i >= char_length(word) THEN
 EXIT;
 END IF;
 END LOOP;
 return (tmp # 4294967295);
 END
 $$ IMMUTABLE STRICT LANGUAGE plpgsql;
[0m
  [4;36;1mSQL (0.1ms)[0m   [0;1mrelease savepoint ts[0m
  [4;35;1mSQL (0.8ms)[0m   [0mcommit[0m
Was it helpful?

Solution

You don't need to do anything. It looks like Rails are just trying to install a plpgsql language, which is already installed, and create a function, that your version of PostgreSQL already has.

Rails are prepared for this and just ignore this errors. Not a good programming example but nothing to worry about.

OTHER TIPS

I realized that this error came up for me because of my fault

  1. dropped test database
  2. created new test database
  3. List item attempted vice-versa while trying to migrate structure of development database to test

Side effects of long working hours ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top