# servoy seq needs to be different

**URL:** <https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312>\
**Category:** Classic Servoy\
**Created:** [January 8, 2015, 6:10pm UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312 "2015-01-08T18:10:49Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![bevil](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bevil](https://forum.servoy.com/u/bevil)\
**Post date:** [January 8, 2015, 6:10pm UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/1 "2015-01-08T18:10:49Z")

</div>

Hi all

I have migrated a Servoy 4 solution to Servoy 7, Sybase to Postgres, and everything is more or less okay.

I do have one problem though which is that I have a pk on one table which, when in Sybase was started at 16000, and has now grown to 18000+.

In Postgres I have to make it continue from the next id (18124), but it is continuing from the next max id (2k something).

The PK is a servoy sequence, not a db sequence, so I cannot use pgadmin to do a

> ALTER SEQUENCE my\_pk\_id RESTART WITH 18124

Servoy developer no longer has the ability to set the start point of a sequence (which was how I set it to 16000 in the first place)

Anybody got the answer that I am looking for?

Thanks.

Bevil

---

<div class="post-metadata">

**Author:** ![swingman](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/swingman/32/4536_2.png) [@swingman](https://forum.servoy.com/u/swingman)\
**Post date:** [January 8, 2015, 6:59pm UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/2 "2015-01-08T18:59:57Z")

</div>

Hi Bevil,

what about using the button on the “database servers” tab in servoy-admin?

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 8, 2015, 10:36pm UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/3 "2015-01-08T22:36:43Z")

</div>

Developer does not use the servoy sequence in the repository I believe. It takes automaticly the higest possible pk. A real servoy server you can reset indeed by using the reset servoy sequence button on the servoy admin page

---

<div class="post-metadata">

**Author:** ![bevil](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bevil](https://forum.servoy.com/u/bevil)\
**Post date:** [January 8, 2015, 11:46pm UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/4 "2015-01-08T23:46:08Z")

</div>

Thanks Harjo and Christian.

I know that I am able to sync the sequence, but that isn’t going to help… I have 2000 rows in my table, and the pk starts at 16000 and ends at 18123 or something. If I sync my sequence, it will just sync with the maxrow 2000something, not the max value, which is 18123…

---

<div class="post-metadata">

**Author:** ![lwjwillemsen](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/lwjwillemsen/32/4987_2.png) [@lwjwillemsen](https://forum.servoy.com/u/lwjwillemsen)\
**Post date:** [January 9, 2015, 7:34am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/5 "2015-01-09T07:34:03Z")

</div>

![:shock:]( "Shocked")

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [January 9, 2015, 7:36am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/6 "2015-01-09T07:36:03Z")

</div>

> Harjo:  
> Developer does not use the servoy sequence in the repository I believe. It takes automaticly the higest possible pk. A real servoy server you can reset indeed by using the reset servoy sequence button on the servoy admin page

That is how it should be.  
On application server I know this is working correct, I have my doubts on correct working in developer…

> bevil:  
> If I sync my sequence, it will just sync with the maxrow 2000something, not the max value, which is 18123…

I’ve experienced similar things in developer, although I didn’t have time to dig into the exact behaviour.

Maybe someone of Servoy can lookup in code what is happening in developer?

---

<div class="post-metadata">

**Author:** ![bevil](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bevil](https://forum.servoy.com/u/bevil)\
**Post date:** [January 9, 2015, 7:45am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/7 "2015-01-09T07:45:49Z")

</div>

Hey Marc

Thank you for the reply…

I have tested in both developer and server, and they both produce the same result. The next pk is 2005 or something, and I cannot override and say it needs to be 18124 anywhere that I can find…

![:(]( "Sad")

Hope you are well and that you had a great Xmas and New Year…

![:)]( "Smile")

Bevil

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 9, 2015, 8:31am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/8 "2015-01-09T08:31:21Z")

</div>

Never seen or experience this behaviour with Servoy sequences…

---

<div class="post-metadata">

**Author:** ![bevil](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bevil](https://forum.servoy.com/u/bevil)\
**Post date:** [January 9, 2015, 8:46am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/9 "2015-01-09T08:46:38Z")

</div>

Hey Harjo

I think it is behaving exactly as it is supposed to… It finds the max pk, and increments it…

The problem is that in the old days, with Sybase, in Developer, you could specify your start point for a sequence, and upload that solution to your server, which would then start the sequence at that number.

I did this because a client wanted a particular number to start at 16000 for legacy reasons.

The problem is that now, when Servoy correctly calculates that there are 2103 rows in the table, increments the pk to 2104. This is out of sync with my number which should be 18124.

I can tell Servoy (developer or server) to sync the sequences, but it then - also correctly - syncs to 2103…

I think I will solve the problem in the dirtiest way possible, by adding 15999 dummy records to the table, and then tablefilterparam them out on start…

I could also unbind my pk from the number I need to use, but I have tried to do that and there is a lot of dependency on it (I know… crappy programming, I should have used an unbound id to begin with, but I built this 5 years ago and didn’t think about it.)

![:)]( "Smile")

Bevil

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 9, 2015, 8:54am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/10 "2015-01-09T08:54:54Z")

</div>

No, this is NOT how it should work.

if the max PK is 21008, after a reset, the next should be 21009!! despite the count of records in the database!!  
Did you try to reset the sequence on a REAL application\_server (with a repository and not started by developer!) ?

---

<div class="post-metadata">

**Author:** ![bevil](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bevil](https://forum.servoy.com/u/bevil)\
**Post date:** [January 9, 2015, 9:00am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/11 "2015-01-09T09:00:43Z")

</div>

Yes, I have run it on a test server. My next id is 2103. It is the same in developer and server…

I will try it again though…

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 9, 2015, 9:05am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/12 "2015-01-09T09:05:52Z")

</div>

Sorry, don’t believe it… ![:shock:]( "Shocked") ![:wink:]( "Wink")

I have done this SO many times, there must be something different (or conflict) in your situation/setup

---

<div class="post-metadata">

**Author:** ![bevil](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bevil](https://forum.servoy.com/u/bevil)\
**Post date:** [January 9, 2015, 9:08am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/13 "2015-01-09T09:08:01Z")

</div>

Sigh… Of course you are right…

I have just tried it again, and yes, it does increment to the right number…

I have been fighting a completely imaginary dragon…

Sorry Harjo, I should have listened in the first place. I did test it, specifically, but must have done something wrong…

![:(]( "Sad")

---

<div class="post-metadata">

**Author:** ![bevil](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bevil](https://forum.servoy.com/u/bevil)\
**Post date:** [January 9, 2015, 9:09am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/14 "2015-01-09T09:09:07Z")

</div>

Thank you for your patience… ![:)]( "Smile")

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [January 9, 2015, 9:18am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/15 "2015-01-09T09:18:16Z")

</div>

![:lol:]( "Laughing") ![:lol:]( "Laughing")

> bevil:  
> Thank you for your patience… ![:)]( "Smile")

---

<div class="post-metadata">

**Author:** ![lwjwillemsen](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/lwjwillemsen/32/4987_2.png) [@lwjwillemsen](https://forum.servoy.com/u/lwjwillemsen)\
**Post date:** [January 9, 2015, 9:23am UTC](https://forum.servoy.com/t/servoy-seq-needs-to-be-different/18312/16 "2015-01-09T09:23:33Z")

</div>

![:D]( "Very Happy") Now I can sleep in peace tonight…

Regards,
