I want to create a table ex. Person. Where Person has name and last_name. I want to add a third field called full_name which is the combination of name and last name.
CREATE TABLE person(
id BIGINT,
name VARCHAR(50),
last_name VARCHAR(50),
full_name VARCHAR(100) *COMBINE(name,last_name)
)
I'm aware that I can create a function like explained here Combine two columns and add into one new column like this
CREATE FUNCTION combined(rec person)
RETURNS text
LANGUAGE SQL
AS $$
SELECT $1.name || $1.last_name;
$$;
SELECT *, person.combined FROM person;
But I would like to declare it in the table as another field, is it possible?