CREATE TYPE physical_address AS (
name text,
extra_recipient_information text DEFAULT NULL,
street_number_and_name text,
extra_street_information text DEFAULT NULL,
post_office_box text,
postal_code text,
locality text,
country text
);
And a table of clients:
CREATE TABLE IF NOT EXISTS clients (
id uuid NOT NULL DEFAULT gen_random_uuid(),
name text NOT NULL,
address physical_address NOT NULL
);
$connection = new Forrest79\PhPgSql\Db\Connection(…);
$some_client = $connection->query(
'SELECT * FROM "clients" LIMIT 1',
)->fetch();
echo $some_client->address . PHP_EOL;
I get an exception:
Forrest79\PhPgSql\Db\Exceptions\DataTypeParserException: Can't parse type 'physical_address' for value '(Some Name,42th street,BP123,75001,Paris,France)'
Hello,
It seems the library does not support PostgreSQL custom types.
Say I have the following
physical_address
type:And a table of clients:
Containing the following row:
With the following code:
I get an exception:
Is there a way to make it work?
Can the library access sub fields? Like: