I have a simple unit test to run in the pgtab https://pgtap.org/documentation.html#is as shown below
BEGIN;
SELECT plan(12);
-- Run the tests.
do
$$
declare
v_expected varchar(100);;
begin
SELECT has_table('unit_test_expected_results');
end;
$$;
-- Finish the tests and clean up.
SELECT * FROM finish();
ROLLBACK;
END
When I write the SELECT has_table('unit_test_expected_results');
inside the begin
and end
I am facing the below error
[2021-06-01 23:50:58] [42601] ERROR: query has no destination for result data
[2021-06-01 23:50:58] Hint: If you want to discard the results of a SELECT, use PERFORM instead.
[2021-06-01 23:50:58] Where: PL/pgSQL function inline_code_block line 5 at SQL statement
Any help will be appreciated
THis is the function from pgtab extension
create function has_table(name, text) returns text
language sql
as
$$
SELECT ok( _rexists( '{r,p}'::char[], $1 ), $2 );
$$;
alter function has_table(name, text) owner to postgres;
If I write below code
begin
SELECT has_table('unit_test_expected_results') INTO v_expected;
end;
OR
begin
PERFORM has_table('unit_test_expected_results');
end;
This works, but there are no result in the output window, however, if I write outside the begin and end everythings works perfectly