Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

503
Views
¿Cómo alterar la secuencia en PostgreSQL con un máximo (id) específico de una tabla?

Necesito seguir la sintaxis del script SQL correctamente. En postgres, realmente no puede encadenar "alterar secuencia" con "seleccionar máximo (id)". Entonces, ¿cuál es la forma correcta de escribir un script de manera que PostgreSQL lo acepte?

Aquí está el script para que pueda tener una idea de lo que necesito:

 alter SEQUENCE notification_settings_seq START with (select max(id) from game_user)
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Esto reinicia su secuencia con un nuevo valor:

 do $$ declare maxid int; begin select max(id) from game_user into maxid; execute 'alter SEQUENCE seq_name RESTART with '|| maxid; end; $$ language plpgsql
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!