In my application we have few test cases which are configured with GitHub workflow,Even I do have only space related changes on file but still getting below error. Not sure why my specs are still failing it was working fine before.
An error occurred in a `before(:suite)` hook.
Failure/Error: ActiveMedian.create_function
ActiveRecord::StatementInvalid:
PG::UndefinedFunction: ERROR: function array_append(anyarray, anyelement) does not exist
: CREATE OR REPLACE FUNCTION median(anyarray)
RETURNS float8 AS
$$
WITH q AS
(
SELECT val
FROM unnest($***) val
WHERE VAL IS NOT NULL
ORDER BY ***
),
cnt AS
(
SELECT COUNT(*) AS c FROM q
)
SELECT AVG(val)::float8
FROM
(
SELECT val FROM q
LIMIT 2 - MOD((SELECT c FROM cnt), 2)
OFFSET GREATEST(CEIL((SELECT c FROM cnt) / 2.0) - ***,0)
) q2;
$$
LANGUAGE sql IMMUTABLE;
DROP AGGREGATE IF EXISTS median(numeric);
DROP AGGREGATE IF EXISTS median(double precision);
DROP AGGREGATE IF EXISTS median(anyelement);
CREATE AGGREGATE median(anyelement) (
SFUNC=array_append,
STYPE=anyarray,
FINALFUNC=median,
INITCOND='{}'
);
# ./spec/rails_helper.rb:***54:in `seed'
# ./spec/rails_helper.rb:***:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# PG::UndefinedFunction:
# ERROR: function array_append(anyarray, anyelement) does not exist
# ./spec/rails_helper.rb:***54:in `seed'
There is ActiveMedian.create_function
on spec/rails_helper.rb
which might causing the issue.
Any lead or suggestion would be appreciated
create_function
, rails, postgres,Also, the things you have tried already etc.? – Damalasarray_append
– Textualist