Insert Statement & Composite Type
От | Grant Martin |
---|---|
Тема | Insert Statement & Composite Type |
Дата | |
Msg-id | BLU161-ds151017CE496288D687A97D0AE0@phx.gbl обсуждение исходный текст |
Ответы |
Re: Insert Statement & Composite Type
|
Список | pgsql-novice |
Hi,
What is the correct INSERT statement syntax to insert a composite type into a table of that type. For example given the following table:
CREATE TABLE licencee
(
id integer NOT NULL DEFAULT nextval('licencee_id_seq'::regclass),
email character varying(254),
salutation character varying(20),
first_name character varying(256),
middle_name character varying(256),
last_name character varying(256),
suffix character varying(20),
locale character varying(20),
business_name character varying(256),
CONSTRAINT licencee_pkey PRIMARY KEY (id )
)
WITH (
OIDS=FALSE
)
How can I write an INSERT procedure like:
CREATE FUNCTION create_licencee(new_licencee licencee) RETURNS boolean AS $$
BEGIN
INSERT INTO licencee new_licencee;
RETURN true;
END;
$$ LANGUAGE plpgsql;
create_licencee((2, mailto:'email@none.com', Mr,Fred, , Flintstone, , locale,, male)::licencee);
Do I have to fully qualify each column name? It would seem redundant in this case.
Thanks,
Grant
Grant
В списке pgsql-novice по дате отправления: