Questions tagged [sequence]
An object that can generate unique integers.
                201 questions
            
            
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                21
            
            views
        
        
            
        Two sequences associated with one identity column
                    One of my clients has a database in which a single identity column
(called id in that table) has two sequences associated with it(!)
Both sequences display
Sequence for identity column: <schema>....
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                312
            
            views
        
        
            
            
        Is concurrently using nextval with generate_series guaranteed to return incremental values?
                    I need to obtain multiple values from a sequence with only one query. On Stack Overflow I found this:
https://stackoverflow.com/questions/896274/select-multiple-ids-from-a-postgresql-sequence
The ...
                
            
       
        
            
                0
            
            votes
        
        
            
                3
            
            answers
        
        
            
                147
            
            views
        
        
            
            
            
        Can a new transaction claim an older sequence id?
                    I'm using a PostgresSQL database as an eventstore. We used to use https://github.com/SQLStreamStore/SQLStreamStore
But they had issues when having a lot of parallel transactions.
Essentially we ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                176
            
            views
        
        
            
            
        ANSI SQL - Generate a sequence and get values
                    wondering if the ANSI SQL standard has a portable way to create a sequence object and get values from it?
I can't find a portable way, but search engines seem to confuse ANSI sql with MS SQL server, ...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                664
            
            views
        
        
            
            
        Is it possible to change the sequence backing an identity column?
                    After a machine malfunction and a hurried transfer of data onto another machine, we have somehow ended up with some brand new sequences replacing old sequences as the backing for identity columns (and ...
                
            
       
        
            
                0
            
            votes
        
        
            
                2
            
            answers
        
        
            
                194
            
            views
        
        
            
            
            
        Trying to renumber a field in order grouping by another
                    So I have a table that has a column labeled 'sequence', it is not in fact a sequence data type, just a numeric field that translates in the object model to show items in a certain order. In a handful ...
                
            
       
        
            
                0
            
            votes
        
        
            
                2
            
            answers
        
        
            
                287
            
            views
        
        
            
            
        (PostgreSQL) Insert a tuple containing specific value in a column linked to a sequence
                    I started writing this post as a question but, while reproducing the error, I found the solution in the PostgreSQL documentation. So I'll share the solution here for the community.
A PostgreSQL 14 ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                79
            
            views
        
        
            
            
        Any way to debug an Oracle Sequence?
                    Somewhere in a large project a sequence is being incremented one too many times. Is there some way to add a trigger or watch to the sequence when .NEXTVAL is invoked so we can get a call stack and see ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                34
            
            views
        
        
            
        PostgreSQL Tables Without Unique Constrtaint On Sequence
                    I use PostgreSQL.  Is there a query to get a list of all tables that do not have the unique constraint on the sequence column?  If it helps forming a query I use "reference" for my sequence ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                401
            
            views
        
        
            
        Query for repeating sequences in SQLite
                    I have an SQLite DB, let's assume the id can be considered as the order of rows, I want to find repeating sequences in the table according to certain criteria.
consider this example (http://sqlfiddle....
                
            
       
        
            
                2
            
            votes
        
        
            
                2
            
            answers
        
        
            
                2k
            
            views
        
        
            
        PosgtreSQL — Is it possible to specify a sequence name in a GENERATED BY DEFAULT AS IDENTITY column?
                    When using PHP’s lastInsertId() method with PostgreSQL, it’s necessary to know the name of the sequence.
If I defined the column using GENERATED BY DEFAULT AS IDENTITY, I know I can get the sequence ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                131
            
            views
        
        
            
            
            
        How to find missing number from different ranges
                    I have a table with two columns, one containing name and other numbers. For each name there is range of numbers and there are around 250 names in there. Range of every name is different. It may be 1 ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                223
            
            views
        
        
            
            
            
        How to increase sequence by condition in Oracle Database 19.x?
                    We have the table as below.
CREATE TABLE "STYLES" (
    "STYLE_CODE" CHAR(8) GENERATED ALWAYS AS
        ("COLOR"||"FEATURE"||"SIZE"||"YEAR")...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                107
            
            views
        
        
            
        PGPOOL Load Balancing: Create Sequence is going to replica
                    I created a pgpool instance which can connect to one master database(primary for write) and one read replica.
I have enabled below parameter:
disable_load_balance_on_write='dml_adaptive';
Now my ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                272
            
            views
        
        
            
            
            
        How to use setval into a function?
                    I created a trigger function to set the value of a sequence in a remote database table, using dblink and setval.
CREATE OR REPLACE FUNCTION my_function () RETURNS TRIGGER AS $$
DECLARE
  ...
BEGIN
   ...