Thread: pgTAP installation
Hi all, I'm just tipping my toe into the water with pgTAP for the first time, and must be doing something wrong - I can't seem to get it working. I'm on Kubuntu Hirsute, and I've installed both PostgreSQL 13 and pgTAP from apt.postgresql.org: sudo apt install postgresql-13 sudo apt install postgresql-13-pgtap Then I connected to my database and installed pgTAP there: create extension pgtap; And I can see it there: gfc_booking6_dev=# \dx List of installed extensions Name | Version | Schema | Description ---------+---------+------------+------------------------------ pgtap | 1.1.0 | public | Unit testing for PostgreSQL plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language (2 rows) However, when I try to use it, I get: gfc_booking6_dev=# select * from noplan(); ERROR: function noplan() does not exist LINE 1: select * from noplan(); ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. Am I missing a step somewhere? Many thanks in advance, Ray. -- Raymond O'Donnell // Galway // Ireland ray@rodonnell.ie
![](https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif)
On Sun, 20 Jun 2021 at 17:18, Ray O'Donnell <ray@rodonnell.ie> wrote:
gfc_booking6_dev=# select * from noplan();
ERROR: function noplan() does not exist
LINE 1: select * from noplan();
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
Am I missing a step somewhere?
Many thanks in advance,
Ray.
--
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie
postgres@db:~/postgresql-14beta1/contrib/pgtap$ psql test
psql (14beta1)
Type "help" for help.
test=# drop extension pgtap;
DROP EXTENSION
test=#
test=# \df
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+------+------------------+---------------------+------
(0 rows)
test=# \i './sql/pgtap.sql' -- Load the TAP functions.
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
test=# \df -- check functions loaded
List of functions
Schema | Name | Result data type | Argument data types
| Type
--------+-------------------------------+------------------------+----------------------------------------------------------------------
--------------------+------
public | _add | integer | text, integer
| func
public | _add | integer | text, integer, text
test=# SELECT * FROM no_plan();
no_plan
---------
(0 rows)
I think you need to load the script to make use of the functions.
where it says-- Load the TAP functions.
Thanks,
Vijay
Mumbai, India
![](https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif)
I was wrong.
the script gets loaded by enabling the extension.
postgres@db:~/postgresql-14beta1/contrib/pgtap$ dropdb test
postgres@db:~/postgresql-14beta1/contrib/pgtap$
postgres@db:~/postgresql-14beta1/contrib/pgtap$ createdb test
postgres@db:~/postgresql-14beta1/contrib/pgtap$ psql test
psql (14beta1)
Type "help" for help.
test=# create extension pgtap;
CREATE EXTENSION
test=# SELECT * FROM no_plan();
no_plan
---------
(0 rows)
On Sun, 20 Jun 2021 at 18:36, Vijaykumar Jain <vijaykumarjain.github@gmail.com> wrote:
I think you need to load the script to make use of the functions.where it says
-- Load the TAP functions.
This was a wrong suggestion. sorry.
i'll try to reproduce what resulted in functions not getting loaded in your case.
Thanks,
Vijay
Mumbai, India
This was a wrong suggestion. sorry.i'll try to reproduce what resulted in functions not getting loaded in your case.
ok i guess you have a typo there. the function name is no_plan(), but you called noplan()
tt=# select * from noplan();
ERROR: function noplan() does not exist
LINE 1: select * from noplan();
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
tt=# SELECT * FROM no_plan();
no_plan
---------
(0 rows)
Thanks,
Vijay
Mumbai, India
On 20/06/2021 14:24, Vijaykumar Jain wrote: > > This was a wrong suggestion. sorry. > i'll try to reproduce what resulted in functions not getting loaded > in your case. > > > ok i guess you have a typo there. the function name is *no_plan()*, but > you called *noplan() * Aaaargh - you're right, that's what the problem was. Thanks very much, and sorry for the noise. Ray. -- Raymond O'Donnell // Galway // Ireland ray@rodonnell.ie