database-sequence Questions
2
I have 2 applications (one is SpringBoot app and another is a C++ app) calling the same Oracle sequence SEQUENCE_A responsible for generating PK on the same table TABLE-A.
The sequence DDL is as:
C...
Dragonhead asked 18/4 at 18:53
35
Solved
I ran into the problem that my primary key sequence is not in sync with my table rows.
That is, when I insert a new row I get a duplicate key error because the sequence implied in the serial data...
Smaragd asked 28/10, 2008 at 18:8
8
Solved
I'm trying to set a sequence to a specific value.
SELECT setval('payments_id_seq'), 21, true;
This gives an error:
ERROR: function setval(unknown) does not exist
Using ALTER SEQUENCE doesn't see...
Arithmomancy asked 5/1, 2012 at 15:28
3
Solved
I am trying to create dynamic start number for sequence but it is not accepting variable viz. @START_SEQ for START WITH. Please consider following code : -
CREATE PROCEDURE [dbo].[SP_RESET_SEQ]
AS...
Unprecedented asked 18/11, 2013 at 7:2
5
I am writing a Spring Boot web-app and using a Postgres db to persist my data. I created a table in Postgres using create table user (id bigserial primary key not null, name text not null; and iden...
Mackenziemackerel asked 7/7, 2017 at 5:9
3
Solved
I'm setting up a identity column to my existing columns for the Patient table.
Here I would like to use GENERATED ALWAYS AS IDENTITY.
So I setup the identity column by using the following statemen...
Rapture asked 14/4, 2019 at 4:6
3
Solved
We use a sequence in a Db2 database. Recently, we have migrated the data from an AIX server to a Linux server. During that the latest number of that sequence was not moved to the Linux system. As a...
Gracie asked 31/1, 2018 at 6:12
1
I have created a sequence (let's call it my_seq) in a schema (let's call it my_schema) of my PostgreSQL (version 13) database. I am sure the sequence exists because I can find it in the result set ...
Normalcy asked 16/6, 2021 at 13:54
5
Solved
I have a table "receipts". I have columns customer_id (who had the receipt) and receipt_number. The receipt_number should start on 1 for each customer and be a sequence. This means that customer_id...
Clichy asked 5/10, 2012 at 12:17
3
Solved
I imported the Postgres SQL file to my server using TablePlus(SQL client), but after I insert new row I got error like this:
SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value viola...
Girardi asked 28/5, 2020 at 8:10
1
Solved
I would like to changes my existing column as Auto Identity in a Postgres Database.
I used below script to set auto identity column and set default start with 1.
But here i would like to reset ide...
Ia asked 13/4, 2019 at 10:34
2
Solved
I have Oracle version 12.2.0.1.0
We have generic script which create sequence that need to be reuse for different objects (by renaming sequence name):
CREATE SEQUENCE NAME_SEQ MINVALUE 1 MAXVALUE 9...
Norrisnorrv asked 10/10, 2018 at 1:48
1
Solved
I have an existing table named "tickets" in database with columns:
id (string, Primary Key, contains UUID like e6c49164-545a-43a1-845f-73c5163962f2)
date (biginteger, stores epoch)
status (string...
Eutherian asked 19/11, 2018 at 7:28
1
Solved
I have a Postgres item where one of my models is Client simply indexed by its primary key. I was having an issue creating clients because somewhere along the lines someone created a client while ex...
Kokaras asked 1/6, 2018 at 19:34
2
Solved
I have two tables:
CREATE TABLE tbl_a (
id serial primary key NOT NULL,
name text NOT NULL,
tbl_b_reference NOT NULL
)
CREATE TABLE tbl_b (
id serial primary key NOT NULL,
status text)
I want t...
Haematic asked 20/9, 2017 at 9:56
1
Solved
I read answers about granting sequences in PostgreSQL. Generally, they say to grant both SELECT, USAGE. I wonder if I can grant only USAGE. Which one is best practice in granting sequences and why?...
Tannie asked 28/7, 2017 at 9:12
2
Solved
I have a table
create table testtable(
testtable_rid serial not null,
data integer not null,
constraint pk_testtable primary key(testtable_rid)
);
So lets say I do this code about 20 times:
...
Demetricedemetris asked 19/1, 2010 at 18:22
3
Solved
Why would we create a sequence even if there is a primary key?
Bohs asked 30/10, 2009 at 10:46
1
© 2022 - 2024 — McMap. All rights reserved.