Cannot cast to type alias

Cannot cast to type alias

I created a type alias&nbsp;<code>gp</code>&nbsp;for the PostgreSQL type&nbsp;<code>money</code>, and I can't figure out from the documentation how I'm supposed to use this.

I created a type alias gp for the PostgreSQL type money, and I can't figure out from the documentation how I'm supposed to use this.

I've set up a test table (and database):

CREATE TYPE gp AS (amt money);
CREATE TABLE test (val gp PRIMARY KEY);

But no matter how I try to insert rows, it fails

INSERT INTO test VALUES (1); -- column "val" is of type gp but expression is of type integer
INSERT INTO test VALUES ((1)); -- column "val" is of type gp but expression is of type integer
INSERT INTO test VALUES (CAST (1 AS gp)); -- cannot cast type integer to gp
INSERT INTO test VALUES (CAST (CAST (1 AS money) AS gp)); -- cannot cast type money to gp
INSERT INTO test VALUES ((amt=1)); -- column "amt" does not exist
INSERT INTO test VALUES ((amt=1)::gp); -- column "amt" does not exist

From what I understand, the gp type should be an alias: gp::money::numeric, so why can't it cast from money to an alias of money?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Learn PostgreSQL, PgAdmin, SQL and JDBC [Combo!] | Simpliv

Learn PostgreSQL, PgAdmin, SQL and JDBC [Combo!]

What is CRUD? | CRUD Operations with SQL and PostgreSQL

What is CRUD? | CRUD Operations with SQL and PostgreSQL - In this course we will be using SQL and PostgreSQL to perform CRUD operations

How to write SQL queries in PostgreSQL

In this tutorial, you will learn how to write simple SQL queries in PostgreSQL.