Recent

Author Topic: Visual PlanIt and Postgress old problem returned  (Read 2318 times)

kkuba

  • New Member
  • *
  • Posts: 47
Visual PlanIt and Postgress old problem returned
« on: October 04, 2023, 11:13:53 am »
I'm afraid the old bug in VisualPlainIt version 1.82 has returned again.  When autocreate is set, an error message appears This involves Postgress. The message comes from ZEOS, about the unsupported word AUTOINCREMENT. This is the same error that was there last year, probably in code added somewhere along the way. For Postgres, you need to set the SERIAL type, not AUTOINCREMENT. @WP, could you look at where this happened? I am attaching the error message.
« Last Edit: October 07, 2023, 10:39:19 pm by kkuba »

paweld

  • Hero Member
  • *****
  • Posts: 851
Re: VisualPlainIT and Postgress old problem returned
« Reply #1 on: October 04, 2023, 11:52:58 am »
What's version of TVPlanIt and what protocol do you use to connect to the DB?     There have been no changes in the code responsible for creating tables since the bug with PGSQL was fixed, that is, since 2022-06-08
« Last Edit: October 04, 2023, 12:16:40 pm by paweld »
Best regards / Pozdrawiam
paweld

rvk

  • Hero Member
  • *****
  • Posts: 5651
Re: VisualPlainIT and Postgress old problem returned
« Reply #2 on: October 04, 2023, 12:01:25 pm »
I'm afraid the old bug in VisualPlainIt version 1.82 has returned again.  When autocreate is set, an error message appears This involves Postgress.

Are you using the correct protocol?

For TVpZeosDatastore it has a TVpZeosDatastore.AdjustSQLFieldTypeNames which should filter out the AUTOINCEMENT for protocol "postgresql".

In version 1.8.2.0
Code: Pascal  [Select][+][-]
  1.     if protocol = 'postgresql' then
  2.       FIdFieldTypeNameInSQL := 'SERIAL NOT NULL PRIMARY KEY'
  3.     else
« Last Edit: October 04, 2023, 12:09:07 pm by rvk »

kkuba

  • New Member
  • *
  • Posts: 47
Re: VisualPlainIT and Postgress old problem returned
« Reply #3 on: October 04, 2023, 03:04:40 pm »
In Lazarus, I use ZEOS simply the stable version. It works without any problem with Postgres version 14.9. WP fixed this bug already last year, but new code snippets were added. To the eye, these fragments are probably related to this bug. That's why I asked WP, to take a look at the issue. The error came out accidentally, it's not every day that you do create on the base. :)

wp

  • Hero Member
  • *****
  • Posts: 11472
Re: VisualPlainIT and Postgress old problem returned
« Reply #4 on: October 04, 2023, 03:30:46 pm »
No changes have been made to the zeos-datastore unit since the last update in OPM (v1.8.2). All the other changed made after v1.8.2 release are not related to databases.

Unfortunately my Postgres installation seems to be broken, thus I cannot look at this issue at the moment in more detail.

paweld

  • Hero Member
  • *****
  • Posts: 851
Re: VisualPlainIT and Postgress old problem returned
« Reply #5 on: October 04, 2023, 03:37:41 pm »
@kkuba: I have checked the example attached to tvplanit (examples\datastore\zeos) and it works without any errors.
Windows 10 x64, PostgreSQL 14.2, Lazarus trunk + FPC 3.2-fixes
Best regards / Pozdrawiam
paweld

kkuba

  • New Member
  • *
  • Posts: 47
Re: VisualPlainIT and Postgress old problem returned
« Reply #6 on: October 04, 2023, 04:45:22 pm »
Maybe there's something wrong on my side - it's happened before. My Lazarus installation has gotten rather thick lately. I'll try reinstalling the component in the evening and let you know if I somehow solved the problem.

rvk

  • Hero Member
  • *****
  • Posts: 5651
Re: VisualPlainIT and Postgress old problem returned
« Reply #7 on: October 04, 2023, 04:48:18 pm »
If it still gives you problems try creating a small reproducible project.

Usually you end up finding the problem yourself that way  :D
(and otherwise we have a small project to find the problem quickly)

kkuba

  • New Member
  • *
  • Posts: 47
Re: VisualPlainIT and Postgress old problem returned
« Reply #8 on: October 04, 2023, 05:43:32 pm »
But that's exactly what I did. My test project consists of a single form. :) 

kkuba

  • New Member
  • *
  • Posts: 47
Re: VisualPlainIT and Postgress old problem returned
« Reply #9 on: October 04, 2023, 08:19:07 pm »
I looked in the code and found the problem (because it is not a typical error). In ZEOS 7.2x there are several possible protocol type choices for Postgres: Postgres, Postgres-7, Postgres-8, Postgres-9. In TVPlaintIt there is only a provided case for selecting the Postgres protocol, the rest of the values are not provided. All in all, it's not worth changing because in ZEOS 8.x this was removed as pointless.
I didn't notice this because I have one project in Delphi and the other in Lazaurus. Of course, unluckily in Lazaurus I have ZEOS version 7.x, which has this strange list.  %)  Sorry WP I suspected you...  O:-)
As a punishment to myself and bothering you, I will try to improve the Polish translation because I see that some things have been added.

wp

  • Hero Member
  • *****
  • Posts: 11472
Re: VisualPlainIT and Postgress old problem returned
« Reply #10 on: October 04, 2023, 08:25:02 pm »
As a punishment to myself [...]
OMG - no violence please  ;D

I looked in the code and found the problem (because it is not a typical error). In ZEOS 7.2x there are several possible protocol type choices for Postgres: Postgres, Postgres-7, Postgres-8, Postgres-9. In TVPlaintIt there is only a provided case for selecting the Postgres protocol, the rest of the values are not provided.
Well, in TVPlanIt this is just a string comparison, I can add them, even if they were used only temporarily. Maybe somebody needs them, and in two years when the next user sees this problem I will have forgotten all this, and we will start anew.

Can you send the exact protocol names?

kkuba

  • New Member
  • *
  • Posts: 47
Re: VisualPlainIT and Postgress old problem returned
« Reply #11 on: October 04, 2023, 08:56:22 pm »
According to your request: In ZEOS 7.x there are values: 'postgresql', 'postgresql-7', 'postgresql-8 and 'postgresql-9'. In ZEOS 8.x, fortunately, there is only value:  'postgresql'.

rvk

  • Hero Member
  • *****
  • Posts: 5651
Re: VisualPlainIT and Postgress old problem returned
« Reply #12 on: October 04, 2023, 09:03:07 pm »
Can you send the exact protocol names?
In the source of zeoslib itself I saw in several places that the check was
If pos('postgres', string) <> 0 or something along those lines.

So there is no need to include them all if you just check the beginning of the string.

wp

  • Hero Member
  • *****
  • Posts: 11472
Re: VisualPlainIT and Postgress old problem returned
« Reply #13 on: October 04, 2023, 10:42:50 pm »
Committed.

Get yourself the file https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/tvplanit/source/addons/zeos/vpzeosds.pas and copy it over the existing one (maybe you should first make a backup copy of the current file, although I do not expect any surprises.) (Or keep your old vpzeosds.pas, search for "postgres" and replace the line "if protocol = 'postgresql'" by "if pos('postgres', protocol) <> 0" as suggested by rvk.)

Now postgresql should work in TvPlanIt also with ZEOS 7.x

kkuba

  • New Member
  • *
  • Posts: 47
Re: Visual PlanIt and Postgress old problem returned
« Reply #14 on: October 08, 2023, 07:22:45 pm »
As announced, I updated the Polish translation. By the way, it looks like it is not working properly: msgctxt "vpsr.rspopupimportfromical"
msgid "Import from iCalendar file(s)...".

 

TinyPortal © 2005-2018