Bug 113617 - Subform Postgresql "The column index out of range: 1, number of columns: 0
Summary: Subform Postgresql "The column index out of range: 1, number of columns: 0
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.3.6.1 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-03 01:36 UTC by jeffsummer
Modified: 2017-11-15 16:06 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
main form general tab (465.75 KB, image/jpeg)
2017-11-15 03:02 UTC, jeffsummer
Details
main form data tab (491.53 KB, image/jpeg)
2017-11-15 03:03 UTC, jeffsummer
Details
subform general tab (458.54 KB, image/jpeg)
2017-11-15 03:03 UTC, jeffsummer
Details
subform data tab (496.08 KB, image/jpeg)
2017-11-15 03:04 UTC, jeffsummer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jeffsummer 2017-11-03 01:36:34 UTC
Description:
Cannot create a subform on a form in Base using postgresql tables connected over jdbc, always shows the error: The data content could not be loaded."  "SQL Status: 22023 The column index is out of range: 1, number of columns: 0."

Steps to Reproduce:
1. Create two related tables in postgresql, as simple as relating the integer field in a second table to the primary key integer field in the first table
2. Connect base to this postgresql database using jdbc
3. Create a new form, use the first table as the outer data source, the second table as the subform data source, then use the integer field as the master and slave link field, then run the form, at that point you get the error message

Actual Results:  
error: The data content could not be loaded."  "SQL Status: 22023 The column index is out of range: 1, number of columns: 0."  The main form gets data, the subform does not

Expected Results:
A running form and subform


Reproducible: Always


User Profile Reset: No



Additional Info:
postgresql 9.6.4
postgresql-42.1.3.jar



User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Comment 2 Alex Thurgood 2017-11-07 13:37:37 UTC
Under Advanced Database Properties, is the "Replace named parameters by '?'" box ticked or not ?

Does it make any difference if you tick/untick  and try your subform again ?
Comment 3 jeffsummer 2017-11-10 00:45:37 UTC
(In reply to Alex Thurgood from comment #2)
> Under Advanced Database Properties, is the "Replace named parameters by '?'"
> box ticked or not ?
> 
> Does it make any difference if you tick/untick  and try your subform again ?

Was not ticked initially, ticked it and the error is the same.
Comment 4 Alex Thurgood 2017-11-10 11:48:56 UTC
@Jeff : I found this thread :

https://forum.openoffice.org/en/forum/viewtopic.php?f=39&t=47480

that might be related to your problem.
Comment 5 Alex Thurgood 2017-11-10 11:54:59 UTC
@Jeff : I'm afraid we're going to need more information.

Can you provide screenshots of the General Tab and Data tab of the properties of :

1) your Form in general; and
2) each linked control ?
Comment 6 Alex Thurgood 2017-11-10 11:59:35 UTC
@Jeff : do you get the same error if you use the postgres native driver instead of the JDBC driver ?
Comment 7 Alex Thurgood 2017-11-10 12:05:20 UTC
Currently, but without more information on the form/subform relationship and any other linked subforms or filtering in the ODB file, it is difficult to be able to be more precise.

However, from the brief information you have provided, this looks like a duplicate of bug 45148, which was closed after a long while for lack of information from the original bug poster.
Comment 8 Alex Thurgood 2017-11-10 12:15:07 UTC
See also this report, which seems similar to yours, using pg9.1 :

https://forum.openoffice.org/en/forum/viewtopic.php?f=13&t=47100#p288816
Comment 9 jeffsummer 2017-11-15 03:02:01 UTC
Created attachment 137762 [details]
main form general tab
Comment 10 jeffsummer 2017-11-15 03:03:26 UTC
Created attachment 137763 [details]
main form data tab
Comment 11 jeffsummer 2017-11-15 03:03:44 UTC
Created attachment 137764 [details]
subform general tab
Comment 12 jeffsummer 2017-11-15 03:04:01 UTC
Created attachment 137765 [details]
subform data tab
Comment 13 jeffsummer 2017-11-15 03:10:29 UTC
-- Table: public.test1

-- DROP TABLE public.test1;

CREATE TABLE public.test1
(
    id1 integer NOT NULL,
    text1 character varying COLLATE pg_catalog."default",
    CONSTRAINT test1_pkey PRIMARY KEY (id1)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.test1
    OWNER to postgres;





-- Table: public.test2

-- DROP TABLE public.test2;

CREATE TABLE public.test2
(
    id2 integer NOT NULL,
    id1 integer,
    text2 character varying COLLATE pg_catalog."default",
    CONSTRAINT test2_pkey PRIMARY KEY (id2),
    CONSTRAINT test1_fkey FOREIGN KEY (id1)
        REFERENCES public.test1 (id1) MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.test2
    OWNER to postgres;
Comment 14 jeffsummer 2017-11-15 15:54:44 UTC
Read closely 108105 

At the end it said you can't just tick the box about parameter ?, you must also close and reopen Libreoffice.  This made it work.  I'm not sure what the bug is here - that a database setting does not take effect or that you have to use that setting at all?
Comment 15 jeffsummer 2017-11-15 15:56:20 UTC
In other words, shouldn't ticking the box and hitting 'okay' be enough - why does one have to save the odb and quit Libreoffice?
Comment 16 Alex Thurgood 2017-11-15 16:06:35 UTC
(In reply to jeffsummer from comment #15)
> In other words, shouldn't ticking the box and hitting 'okay' be enough - why
> does one have to save the odb and quit Libreoffice?

So, as I understand it, the driver parameters for JDBC drivers (including SQL statement parameter substitution) are generally loaded at creation of the database connection instance. They are not automatically updated in a running active session (I don't know why, perhaps it would render the whole thing potentially unstable, or have some other unforeseeable consequence, like a performance hit or threading issues).

As you have solved the problem you were experiencing, with the indication given in bug 108105, and Comment 2 here, this can be set to resolved works for me.