SQL Status:42703 column does not exist

Guten Tag!
Ich bin neu hier, die Antworten auf Status 42703 im Forum oder www haben mir nicht weitergeholfen.

Ich hab “PostgreSQL 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, 64-bit”

Darauf ist odoo12 (OpenErp) installiert mit seiner Datenbank.

Mein Problem ist, daß eine auf das Minimum reduzierte Test-Abfrage nicht funktioniert.

select product_templ_id from product_product;
(oder auch select product_product.product_templ_id from product_product;
oder select “product_product.product_templ_id” from “product_product”:wink:

bringt die Meldung:

ERROR: column product_product.product_templ_id does not exist
LINE 1: select product_product.product_templ_id from product_product…
^
HINT: Perhaps you meant to reference the column “product_product.product_tmpl_id”.

********** Fehler **********

ERROR: column product_product.product_templ_id does not exist
SQL Status:42703
Hinweis:Perhaps you meant to reference the column “product_product.product_tmpl_id”.
Zeichen:8

Die Tabelle ist:
CREATE TABLE public.product_product
(
id integer NOT NULL DEFAULT nextval(‘product_product_id_seq’::regclass),
default_code character varying, – Internal Reference
active boolean, – Active
product_tmpl_id integer NOT NULL, – Product Template
barcode character varying, – Barcode
volume double precision, – Volume
weight numeric, – Weight
message_main_attachment_id integer, – Main Attachment
create_uid integer, – Created by
create_date timestamp without time zone, – Created on
write_uid integer, – Last Updated by
write_date timestamp without time zone, – Last Updated on
CONSTRAINT product_product_pkey PRIMARY KEY (id),
CONSTRAINT product_product_create_uid_fkey FOREIGN KEY (create_uid)
REFERENCES public.res_users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT product_product_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id)
REFERENCES public.ir_attachment (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT product_product_product_tmpl_id_fkey FOREIGN KEY (product_tmpl_id)
REFERENCES public.product_template (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE,
CONSTRAINT product_product_write_uid_fkey FOREIGN KEY (write_uid)
REFERENCES public.res_users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT product_product_barcode_uniq UNIQUE (barcode) – unique(barcode)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.product_product
OWNER TO odoo12;
COMMENT ON TABLE public.product_product
IS ‘Product’;
COMMENT ON COLUMN public.product_product.default_code IS ‘Internal Reference’;
COMMENT ON COLUMN public.product_product.active IS ‘Active’;
COMMENT ON COLUMN public.product_product.product_tmpl_id IS ‘Product Template’;
COMMENT ON COLUMN public.product_product.barcode IS ‘Barcode’;
COMMENT ON COLUMN public.product_product.volume IS ‘Volume’;
COMMENT ON COLUMN public.product_product.weight IS ‘Weight’;
COMMENT ON COLUMN public.product_product.message_main_attachment_id IS ‘Main Attachment’;
COMMENT ON COLUMN public.product_product.create_uid IS ‘Created by’;
COMMENT ON COLUMN public.product_product.create_date IS ‘Created on’;
COMMENT ON COLUMN public.product_product.write_uid IS ‘Last Updated by’;
COMMENT ON COLUMN public.product_product.write_date IS ‘Last Updated on’;

COMMENT ON CONSTRAINT product_product_barcode_uniq ON public.product_product IS ‘unique(barcode)’;


– Index: public.product_product_default_code_index

– DROP INDEX public.product_product_default_code_index;

CREATE INDEX product_product_default_code_index
ON public.product_product
USING btree
(default_code COLLATE pg_catalog.“default”);

– Index: public.product_product_message_main_attachment_id_index

– DROP INDEX public.product_product_message_main_attachment_id_index;

CREATE INDEX product_product_message_main_attachment_id_index
ON public.product_product
USING btree
(message_main_attachment_id);

– Index: public.product_product_product_tmpl_id_index

– DROP INDEX public.product_product_product_tmpl_id_index;

CREATE INDEX product_product_product_tmpl_id_index
ON public.product_product
USING btree
(product_tmpl_id);


Odoo oder auch Abfragen auf andere Tabellen funktionieren durchaus.

Auch Abfragen auf die anderen Felder dieser Tabelle funktionieren.
z.B select message_main_attachment_id from product_product;

Woran kann das liegen?

kind regards - Gottfried

Die Fehlermeldung “ERROR: column product_product.product_templ_id does not exist” ist ja auch korrekt.
Die Spalte heisst product_tmpl_id - zumindest steht sie so im CREATE TABLE von Dir drin. (Und der “Hint” schlägt ja auch die Spalte vor)

Wenn man das alles richtig schreibt, funktioniert es: https://rextester.com/DVJSR78697

Irgendwo hast Du noch einen Tippfehler drin.

Hallo!
Unglaublich aber wahr.
deprimierend, wenn man seit Tagen nach dem Fehler sucht, alles mit der Lupe inspiziert, mit dem Hexeditor überprüft, ob auch alles
normale ASCII-Zeichen sind u.s.w.

tmpl statt templ stimmt.
So geht’s!
Heureka!
1000 Dank!