how to change column size in developer

Questions and answers regarding general SQL and backend databases

how to change column size in developer

Postby stevek » Tue Dec 02, 2014 9:03 pm

Hello all!

I have a postgresql 9.3 database with a table (mytable) and column (mycolumn) that was created from within developer

The column is listed in developer as TEXT and 5000 in length

I viewed it in psql \d mycolumn and saw the column was actually varchar and not "TEXT" as specified in developer


I changed the size in PGadmin to 10,000 but developer will not see the difference

How can get developer to recognize the change in this column?

I physically rebooted the computer in hopes that would help but it did not


Is my only solution to do a pg_dump, delete the column from within developer, re-create the column to match the size in postgresql and pg_restore?


Thanks for any input
stevek
 
Posts: 53
Joined: Thu Jan 25, 2007 7:19 pm

Re: how to change column size in developer

Postby mboegem » Tue Dec 02, 2014 9:41 pm

Hi stevek,

reason why developer will not update is because the TEXT type column doesn't contain any length information in PG.
if you'd use VARCHAR(10000) you will see dat Servoy will prompt the difference.

When you create a text type column with length 0 from developer Servoy will create a TEXT type column in PG for you.
If you really want to change the display size in Servoy there are 2 options:
1) drop the column and create it again as described above
2) manually edit the DBI file of the table which can be found in the resource project folder in your workspace.
Please note that in order for Eclipse to keep track of your changes, you need to do this from within Eclipse.
I suggest to add the 'Navigator' view to your perspective and then rightclick the DBI file and select 'open with text editor'

B.T.W.: The allowed number of characters in the column will not be restricted by the number you see in Servoy.
Database is leading here, not the size as specified in Servoy.
Servoy will prompt however if you exceed the size as it is in the DB.

Hope this helps
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1749
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: how to change column size in developer

Postby stevek » Wed Dec 03, 2014 8:31 pm

Mark,

Yes this is a great help!

What I ended up doing on a test platform is doing a pg_dump of the database, then deleting the column from within eclipse and recreating it, modifying the size from 5000 to 10000. I restarted developer to make sure the setting stuck.
The deletion and re-creation of the column deleted all data, so I did a pg_restore to get it back.

I then modified the value of the column in postgresql (ALTER TABLE mytable ALTER COLUMN mycolumn TYPE character varying(10000);

Restarted both postgresql and servoy developer, no errors.

Inserted a gob of data into the column (9900) and it read fine within developer with no errors.

Kinda kludgy sequence, but works great! Now to duplicate one last time before tossing all onto our production server.

Thanks again!
stevek
 
Posts: 53
Joined: Thu Jan 25, 2007 7:19 pm


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 5 guests