For those who use database sequences things changed a bit in Servoy 4. The table editor (that is the data providers tab) doesn’t allow you to type sequence names longer than 30 characters !
This is different of how things work in Servoy 3.5.x and below.
I filed issue #165822 for this.
I also noticed when you don’t provide a sequence name in the table editor it will make one up for you using the following format: seq_tablename_pkname. Which is good.
BUT it does apply that same 30 character limit on it and will clip the name somewhere in the middle.
To make matters worse when a sequence name doesn’t exist in the back-end database it will create one for you, silently .
This also happens when you make a typo when entering in the sequence name yourself. This is very much new behavior in comparison with Servoy 3.5.x and below and on the whole I think it’s a nice addition that it creates one for you.
But I also think that Servoy should notify the developer that this particular database sequence doesn’t exist yet and if he/she wants to create one in the back-end yes or no. I am sure any DBA will agree .
I filed feature request #165838 for this.
So to work around all of this you can do the following;
Go to the Navigator view. If you don’t have that view in your perspective than you can add it by selecting in the menubar > Window > Show View.
In the Navigator you can see all files in your local workspace. In the resources folder you find the .dbi files (in datasource// ).
By right-clicking and selecting Open With > Text Editor you see the following:
that Servoy creates Sequences for you is not new to Servoy 4. Servoy 3.5.x does that as well. While there have been some bugs in this it works nicely now in 3.5.7. I don’t think the creation of a sequence is a problem for a DB admin. In the worst case there is an unused object. The non existence of a sequence that a solution relies on is much worse, in my eyes. The 30 character limit is due to Oracle (at least). Any object in Oracle (unfortunately) has this 30 character limit.
patrick:
that Servoy creates Sequences for you is not new to Servoy 4. Servoy 3.5.x does that as well.
Ah, I guess I missed that.
patrick:
I don’t think the creation of a sequence is a problem for a DB admin. In the worst case there is an unused object.
Very true but if you do that at a customer site some DBA’s might look at you funny (or worse)
patrick:
The non existence of a sequence that a solution relies on is much worse, in my eyes. The 30 character limit is due to Oracle (at least). Any object in Oracle (unfortunately) has this 30 character limit.
I didn’t know Oracle had that limit throughout. PostgreSQL doesn’t have this limit though and sequence names longer than 30 chars are often more the rule than the exception so this is an issue for me.
I rather have Servoy yell at me for using objectnames longer than 30 characters than outright denying me to do so.
Servoy aims to make solutions portable across database vendors, so we will limit the editors to the least common denominator (Oracle in this case who does limit names to 30 chars).
The same for column names, if you want to add a column whose name is a keyword in one database we will disallow it, even if he name is not a keyword in the current database.
Note that Servoy will always support what is created in the database, so if you create a table or sequence with a name of more than 30 chars, it will still work but it won’t be portable to Oracle.
rgansevles:
Note that Servoy will always support what is created in the database, so if you create a table or sequence with a name of more than 30 chars, it will still work but it won’t be portable to Oracle.
I do indeed use an external tool to create my databases.
When I create a table with a sequence (of any length) Servoy will default to dbidentity for that table. So I need to tell Servoy that it needs to use dbsequences. When I do that I need to fill in a sequence name or else it will assign one for me (with a 30 character limit). So I need to fill in the sequence name by hand but Servoy’s table editor doesn’t let me.
So in my view something has to give here. Or Servoy needs to automatically recognise that a table uses dbsequences and which one, or Servoy has to let me be able to type in a long sequence name.
Now that is Postgres. In Oracle you have a sequence, which is just an object as any other (for example a table). That sequence can even be used for several tables. To allow Oracle to automatically use such a sequence you have to create a trigger that queries the sequence if the PK is empty. As you can see, a completely different implementation. How would you take that apart?
patrick:
Now that is Postgres. In Oracle you have a sequence, which is just an object as any other (for example a table). That sequence can even be used for several tables.
That is exactly how it works in PostgreSQL as well. Sequences are objects (special tables) and can indeed be used by multiple columns in multiple tables.
In PostgreSQL you could use a trigger for this but by default it uses the previously described method. In any case it would be an easy way to automatically let Servoy set the correct values in the dataprovider properties.
I know it’s not perfect but right now it doesn’t discover anything what dbsequences concerns so if it can discover something it would be a plus.
Hi, just want to say that I use DB identities in PostgreSQL in Servoy 3.5.x.
Upgraded from 3.5.5 to 3.5.7 last weekend and 4 of my tables had their DB identities mysteriously changed to DB sequences after the upgrade. This caused all sorts of problems before I discovered what was wrong Have reported this before.