just obtain the next value from the sequence first, then do the insert:
CREATE OR REPLACE FUNCTION insert_row(text) returns text language plpgsql
AS $$
DECLARE
vdesc alias for $1;
new_id INTEGER;
BEGIN
SELECT nextval('sequence_name_here') INTO new_id;
INSERT INTO productos (id,
Hi, how can i know the values generated by a column of type serial?
I mean, i have the following table
productos
(
id serial,
desc varchar(50)
)
select * from productos;
+-++
| id | desc |
+-++
| 1 | ecard1 |
| 2 | ecard2 |
| 3 | ecard3