Bug 124530 - PostgreSQL Native Driver: Images aren't shown in form when content of field is created in query
Summary: PostgreSQL Native Driver: Images aren't shown in form when content of field i...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.1.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Connectivity
  Show dependency treegraph
 
Reported: 2019-04-03 16:50 UTC by Robert Großkopf
Modified: 2020-02-09 08:05 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2019-04-03 16:50:54 UTC
You will need a PostgreSQL-database for testing this:

1. Create a table in PostgreSQL:
CREATE TABLE "public"."PG_LOconn" (
   "ID" serial NOT NULL,
   "PathName" text NULL,
   "PicName" text NULL,
   CONSTRAINT "PG_LOconn_pkey" PRIMARY KEY ("ID")
);
2. Create a form for input data into this table. "PathName" should save the path to the image - so an image-control is needed. "PicName" should save only the name of the image.
3. Insert one row in this table through the form.
4. Create a query like
SELECT "ID", "PathName", "PicName", CONCAT( '/home/yourname/', "PicName" ) AS "PicPathName" FROM "public"."PG_LOconn"
The first part of the CONCAT-Function should be the same as in "PathName", so could also be a relative link.
5. Open the form for editing, link the form to the query and create a new image-control for "PicPathName".
6. Open the form for input data.
Bug: The image of the "PicPathName" won't be shown in PostgreSQL with the native driver.
Now change the connection to PostgreSQL to JDBC. The image will be shown in "PicPathName".

All tested with 
Version: 6.2.2.2
Build-ID: 2b840030fec2aae0fd2658d8d4f9548af4e3518d
CPU-Threads: 6; BS: Linux 4.12; UI-Render: Standard; VCL: gtk3; 
Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE
Calc: threaded
on OpenSUSE 15, 64bit rpm Linux
Comment 1 Michael 2019-04-03 17:33:55 UTC
Same misbehaviour here:

All tested with 
Version: 6.1.5.2
Build-ID: 90f8dcf33c87b3705e78202e3df5142b201bd805
CPU-Threads: 4; BS: Linux 4.18; UI-Render: Standard; VCL: kde4;
Gebietsschema: de-DE (de_DE.UTF-8); Calc: group threaded
on kUBUNTU 18.04
Comment 2 Robert Großkopf 2019-04-03 17:38:54 UTC
Setting version to 6.1.5.2 and status to NEW. See comment 1.
Comment 3 Alex Thurgood 2019-04-04 16:57:10 UTC
JDBC
I was unable to use the JDBC driver connection to create a form.
If I use the wizard, it appears to work, but a form is never saved to the ODB file, just temporary ODT files which then disappear (but appear in the StartCenter and are impossible to load ("missing file" error message).

If I try to use the manual form creation, there is no way to bind the form control to the data field of the db table, in the Control Properties Data tab, no fields are visible, and I can not activate the general form properties to point to a table to which to bind the form.

Direct PG Driver
I was able to create a form using the wizard, then modify the controls on the form.
However, replacing the original text control with an image control, saving the form, then opening the form in data entry mode to enter a first record causes LO to hang after I click on the image control, point to an image (e.g. EPS image), which is displayed, and then attempt to write the record set to the database. In my case, instead of writing the path, it appears to try and write binary data to the field defined as TEXT.

I am then forced to quit LO, and no image data or image path is saved to the database - a query on the table "SELECT * from PG_LOconn" via pgconsole also shows that the field pathname seems to contain an endless stream of nothing - here again, I am forced to quit the console with the q command to regain control.

Seems that there are more problems on macOS with such a setup.
Comment 4 Robert Großkopf 2019-04-04 18:54:51 UTC
(In reply to Alex Thurgood from comment #3)
> Seems that there are more problems on macOS with such a setup.

We don't have this problem with Linux (OpenSUSE and Kubuntu). So it seems there are a lot more bugs with macOS/Base/PostgreSQL. Seems this combination isn't usable at all.
Comment 5 Alex Thurgood 2019-04-05 07:32:36 UTC
So, today, when I open the same PG-JDBC-ODB file that I created yesterday and was having so many issues with, I can create a form using the wizard, and I see the binary data represented in the text field. Go figure !


I'm going to retest everything I did yesterday.
Comment 6 Alex Thurgood 2019-04-05 08:56:07 UTC
Well, nothing I seem to choose on macOS as path separators '/' or '\' seems to work to form a valid URL that will display the image in an Image Control, irrespective of JDBC-PG or native PG driver.

I never see an image in the basic image control bound to PathName, and the image control bound to the query with concat just shows a transparent control with a border (not even the grey background, even though this is defined in the control's properties). Clearly, there are some other issues on macOS.
Comment 7 Robert Großkopf 2020-02-09 08:05:26 UTC
Problem seems to be PostgreSQL doesn't set the datatype the right way.
If I change the query to
4. Create a query like
SELECT "ID", "PathName", "PicName", CONCAT( '/home/yourname/', "PicName" ) AS "PicPathName" FROM "public"."PG_LOconn"

tO

SELECT "ID", "PathName", "PicName", CAST(CONCAT( '/home/yourname/', "PicName" ) AS VARCHAR(100)) AS "PicPathName" FROM "public"."PG_LOconn"

it will work.

So I will close this bug as WORKSFORME.