how do I generate a series starting from the last id in the table, generate_series(last id, 10000)? Say the last id is 101 in the table I would like to generate ids 102-10000 in the table. Currently I have this

    INSERT INTO table_a
    SELECT i, 'A' || i::text, 'UNKNOWN'
    FROM generate_series(102, 10000) AS t(i);

But if I don't know the value of the last id how would I go about getting this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.