Ad
  • Custom User Avatar

    I have a solutions that works using 'create function - unnest - ordinality - cardinality', but still I hece the same error:
    I do not what is happening....any suggestion? Thks

    --- Caused by: ---

    PG::UndefinedFunction:

    ERROR: operator does not exist: integer[] + integer[]

    LINE 1: SELECT id, a, b, c, a + b AS "a + b", (a + b) + c AS "(a + b...

    ^

    HINT: No operator matches the given name and argument types. You might need to add explicit type casts.

    /usr/local/bundle/gems/sequel-5.47.0/lib/sequel/adapters/postgres.rb:156:in `exec'

    No examples found.

  • Custom User Avatar

    I am following an approach with "WITH RECURSIVE xxx", am I in the right way? Some feedback will be useful Regards

  • Custom User Avatar

    Any suggestion about my code, it does not work!!!!

    CREATE OR REPLACE FUNCTION sumtot()
    RETURNS TABLE(tbl text, col text, val bigint)
    LANGUAGE plpgsql AS
    $func$
    DECLARE
    row_aux1 record;
    BEGIN
    FOR r_aux1 IN

      (select
      quote_ident(cl.table_name) as tbl
      ,quote_ident(cl.column_name) as col
      from information_schema.columns cl
      join information_schema.tables  tb
          on  tb.table_schema = cl.table_schema
          and tb.table_name   = cl.table_name
          and tb.table_type   = 'BASE TABLE'
      where cl.data_type in ('int')
      group by tbl, col)  
    

    LOOP
    RETURN QUERY EXECUTE
    'SELECT ' || r_aux1 || '.tbl, ' || r_aux1 || '.col, sum(' || r_aux1 || '.col) as val
    FROM ' || r_aux1 || '.tbl';
    END LOOP;
    END
    $func$;

    select sum (val) as total
    from sumtot ()

  • Custom User Avatar

    'a' should equal 'b' means 'your_answer' is not equal to 'the_correct_answer'.

  • Custom User Avatar

    I am passing the test, but when a tried to submit appears this kind of message. Can any body explain me the meaning of this output? [(-4.858929811522968, 0.2269496944683853), (-4.840078207932429, 0.21312952312188882)] should equal [(-3.5587688552056695, -2.2272483581593514), (-3.550921135594966, -2.2265393538098217)]
    [(1.8352727691108854, -0.139842271493766), (1.838386896423125, -0.13485179949526183)] should equal [(2.0181619767831975, 0.966640896611003), (2.019942455045757, 0.9688923640365206)]
    [(-1.1177824333558144, 1.0732807838376273), (-1.1137508275351435, 1.0743278696785632)] should equal [(-0.9632187422049228, 1.327878316853926), (-0.962858502531326, 1.326125436930604)]