CQL unknown procedure {}/1

Since I have a potential interest in using CQL in the future I am looking at your question, but note that I have never used CQL before.

In looking at the code on GitHub noticed a demo file. Have you run this?

I am trying to figure out how to create the database with PostgreSQL to use for the demo. If you have figured this out and can post here that will save me some effort.


Personal Notes

To create database for use with CQL demo. Based on instructions in cql_demo.pl

Using PostgreSQL on Ubuntu 20.04 on WSL 2
Using psql

  1. Start psql.
root@galaxy:/mnt/c/Users/Groot# sudo -u postgres psql

Note: psql commands are case sensitive so CREATE is not a valid command.
2. Create empty database.

postgres=# create database cql_demo;
  1. Verify database created.
postgres=# \l
                              List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges
-----------+----------+----------+---------+---------+-----------------------
 cql_demo  | postgres | UTF8     | C.UTF-8 | C.UTF-8 |
 postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 |
 template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
 template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
(4 rows)
  1. Install extension.
postgres=# create extension "uuid-ossp";
CREATE EXTENSION
  1. Verify extension installed.
postgres=# \dx
                            List of installed extensions
   Name    | Version |   Schema   |                   Description
-----------+---------+------------+-------------------------------------------------
 plpgsql   | 1.0     | pg_catalog | PL/pgSQL procedural language
 uuid-ossp | 1.1     | public     | generate universally unique identifiers (UUIDs)
(2 rows)
  1. Change to the cql_demo databse.
postgres=# \c cql_demo
You are now connected to database "cql_demo" as user "postgres".
  1. Verify the cql_demo database has no tables.
cql_demo=# \dt
Did not find any relations.
  1. Add the table cql_table_1.
cql_demo=# create table cql_table_1(cql_table_1_pk SERIAL PRIMARY KEY, varchar_column varchar(30));
CREATE TABLE
  1. Verify table cql_table_1 created.
cql_demo=# \dt
            List of relations
 Schema |    Name     | Type  |  Owner
--------+-------------+-------+----------
 public | cql_table_1 | table | postgres
(1 row)
  1. Add the table cql_table_2 and verify creation.
cql_demo=# create table cql_table_2(cql_table_2_pk SERIAL PRIMARY KEY, varchar_column varchar(30), decimal_column DECIMAL(30,10));
CREATE TABLE
cql_demo=# \dt
            List of relations
 Schema |    Name     | Type  |  Owner
--------+-------------+-------+----------
 public | cql_table_1 | table | postgres
 public | cql_table_2 | table | postgres
(2 rows)
  1. Create new user so that postgres does not own the database.
postgres=# create user eric with password 'password';
CREATE ROLE
  1. Verify user created.
postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 eric      |                                                            | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
  1. Make user eric owner of database cql_demo and verify.
postgres=# alter database cql_demo owner to eric;
ALTER DATABASE
postgres=# \l
                              List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges
-----------+----------+----------+---------+---------+-----------------------
 cql_demo  | eric     | UTF8     | C.UTF-8 | C.UTF-8 |
 postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 |
 template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
 template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
(4 rows)
  1. Create entry in odbc.ini
    See: SWI-Prolog connecting to PostgreSQL via ODBC
root@galaxy:~# sudo nano /etc/odbc.ini

FIle: /etc/odbc.ini

[SWI-Prolog CQL]
Description = SWI-Prolog CQL example
Driver      = PostgreSQL Unicode
Servername  = localhost
Database    = cql_demo
UserName    = eric
Password    = password
Port        = 5432
  1. Verify connection possible using ODBC.
root@WINDOWS-6F874NS:~# iusql -v "SWI-Prolog CQL"
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> quit
2 Likes