Skip to content

Scalar

This documentation is also tests for the code, the examples below show the literal output of these statements from Postgres.

Some setup to make sure warnings are shown, and that the extension is installed.

set client_min_messages = 'WARNING';
create extension if not exists onesparse;
Describe the scalar type
                                                      List of data types
  Schema   |  Name  | Internal name | Size | Elements |  Owner   | Access privileges |               Description               
-----------+--------+---------------+------+----------+----------+-------------------+-----------------------------------------
 onesparse | scalar | scalar        | var  |          | postgres |                   | Scalars hold individual element values.
(1 row)
print a scalar, this renders the value with no prefix
select print('int32:42'::scalar);
 print 
-------
 42
(1 row)
Duplicate a scalar
select dup('int32:42'::scalar);
   dup    
----------
 int32:42
(1 row)
Wait for a scalar to complete in non-blocking mode
select wait('int32:42'::scalar);
   wait   
----------
 int32:42
(1 row)
Clear a scalar, deleting its stored element.
select clear('int32:42'::scalar);
 clear 
-------
 int
(1 row)