I can't set Master/Detail relation ship. I get 'unexpected server respons' or 'Field "Id_Tableau_Bord" not found' when opening any of the details queries.
Step to reproduce on PostgreSQL 9.3.0 :
- Create database object (run SQL script)
- Paste the DFM code into a new form
- Connect to Postgresql server
- open details queries
Here is the DFM code (just paste it on an empty Delphi form)
Code: Select all
object mainconnection: TUniConnection
ProviderName = 'PostgreSQL'
Database = 'devart'
SpecificOptions.Strings = (
'PostgreSQL.ApplicationName=myApp'
'PostgreSQL.Schema=public'
'DB2.UseUnicode=True'
'PostgreSQL.Charset=ISO-8859-1'
'PostgreSQL.UseUnicode=True'
'PostgreSQL.ConnectionTimeout=3')
Options.DisconnectedMode = True
Options.KeepDesignConnected = False
Options.LocalFailover = True
Username = 'postgres'
Server = 'localhost'
Left = 80
Top = 8
end
object PostgreSQLUniProvider1: TPostgreSQLUniProvider
Left = 24
Top = 8
end
object dsTableauBord: TUniDataSource
DataSet = qrTableauBord
Left = 64
Top = 72
end
object qrTableauBord: TUniQuery
UpdatingTable = 'tableaux_bords'
Connection = mainconnection
SQL.Strings = (
'select *'
'from'
'tableaux_bords')
Options.QuoteNames = True
Options.DefaultValues = True
Active = True
Left = 24
Top = 72
end
object qrTableauBord_Utilisateurs_Dispos: TUniQuery
UpdatingTable = 'utilisateurs_tableaux_bords'
Connection = mainconnection
SQL.Strings = (
'SELECT '
' utilisateurs."Utilisateur",'
' Cast(:Id_Tableau_Bord as Char(20)) as "Id_Tableau_Bord"'
'FROM'
' utilisateurs'
' LEFT OUTER JOIN utilisateurs_tableaux_bords ON (utilisateurs."' +
'Utilisateur" <> utilisateurs_tableaux_bords."Utilisateur"'
' and'
' utilisateurs_tableaux_bords."Id_Tableau_Bord" = :Id_Tableau_Bo' +
'rd )')
MasterSource = dsTableauBord
MasterFields = '"Id_Tableau_Bord"'
Options.DefaultValues = True
Left = 87
Top = 128
ParamData = <
item
DataType = ftWideString
Name = '"Id_Tableau_Bord"'
ParamType = ptInput
Value = 'LOG0001'
end>
end
object dsTableauBord_Utilisateurs_Dispos: TUniDataSource
DataSet = qrTableauBord_Utilisateurs_Dispos
Left = 119
Top = 128
end
object qrTableauBord_Utilisateurs: TUniQuery
UpdatingTable = 'utilisateurs_tableaux_bords'
Connection = mainconnection
SQL.Strings = (
'SELECT *'
'FROM'
' utilisateurs_tableaux_bords')
MasterSource = dsTableauBord
MasterFields = '"Id_Tableau_Bord"'
DetailFields = '"Id_Tableau_Bord"'
Options.DefaultValues = True
Left = 87
Top = 176
ParamData = <
item
DataType = ftWideString
Name = '"Id_Tableau_Bord"'
ParamType = ptInput
Value = 'LOG0001'
end>
end
object dsTableauBord_Utilisateurs: TUniDataSource
DataSet = qrTableauBord_Utilisateurs
Left = 119
Top = 176
endCode: Select all
SET search_path = public, pg_catalog;
DROP INDEX IF EXISTS public.tableaux_bords_idx1;
DROP INDEX IF EXISTS public.tableaux_bords_idx;
DROP INDEX IF EXISTS public.utilisateurs_tableaux_bords_idx2;
DROP INDEX IF EXISTS public.utilisateurs_tableaux_bords_idx1;
DROP INDEX IF EXISTS public.utilisateurs_new_idx1;
DROP INDEX IF EXISTS public.utilisateurs_new_idx;
DROP TABLE IF EXISTS public.tableaux_bords;
DROP TABLE IF EXISTS public.utilisateurs_tableaux_bords;
DROP TABLE IF EXISTS public.utilisateurs;
SET check_function_bodies = false;
--
-- Structure for table utilisateurs (OID = 487120) :
--
CREATE TABLE public.utilisateurs (
"Utilisateur" varchar(25) DEFAULT ''::character varying NOT NULL,
"Mot_de_passe" varchar(25) NOT NULL,
"Id_Matricule" varchar(10) DEFAULT ''::character varying NOT NULL,
"Nom" varchar(100) DEFAULT ''::character varying NOT NULL,
"Prenom" varchar(100) DEFAULT ''::character varying NOT NULL,
"Date_Creation" date DEFAULT ('now'::text)::date,
"Heure_Creation" time(0) without time zone DEFAULT ('now'::text)::time with time zone,
"Date_Dernier_Acces" date DEFAULT ('now'::text)::date,
"Heure_Dernier_Acces" time(0) without time zone DEFAULT ('now'::text)::time with time zone,
"Nombre_Acces" integer DEFAULT 0,
"Actif" boolean DEFAULT true,
"Date_Desactivation" timestamp(0) without time zone,
"Gestionnaire_Flux" boolean DEFAULT false,
"Gestionnaire_Impressions" boolean DEFAULT false,
"Gestionnaire_Tableaux_Bords" boolean DEFAULT false,
"Gestionnaire_Preferences" boolean DEFAULT false,
"Gestionnaire_Utilisateurs" boolean DEFAULT false,
"Gestionnaire_Structure_Organisationnelle" boolean DEFAULT false,
"Clients" boolean DEFAULT true,
"Clients_Creer" boolean DEFAULT true,
"Clients_Editer" boolean DEFAULT true,
"Clients_Bloquer" boolean DEFAULT true,
"Clients_Supprimer" boolean DEFAULT true,
"Clients_RDV_Commercial" boolean DEFAULT true,
"Clients_Imprimer" boolean DEFAULT true,
"Agendas" boolean DEFAULT true,
"Agendas_Creer" boolean DEFAULT true,
"Agendas_Editer" boolean DEFAULT true,
"Agendas_Supprimer" boolean DEFAULT true,
"Agendas_Imprimer" boolean DEFAULT true,
"Tableaux_Bords" boolean DEFAULT true,
"Tableaux_Bords_Exporter" boolean DEFAULT true,
"Documents" boolean DEFAULT true,
"Documents_Creer" boolean DEFAULT true,
"Documents_Editer" boolean DEFAULT true,
"Documents_Supprimer" boolean DEFAULT true,
"Reglements" boolean DEFAULT true,
"Reglements_Creer" boolean DEFAULT true,
"Reglements_Editer" boolean DEFAULT true,
"Reglements_Valider" boolean DEFAULT true,
"Reglements_Comptabiliser" boolean DEFAULT true,
"Reglements_Supprimer" boolean DEFAULT true,
"Reglements_Imprimer" boolean DEFAULT true,
"Affaires" boolean DEFAULT true,
"Affaires_Creer" boolean DEFAULT true,
"Affaires_Editer" boolean DEFAULT true,
"Affaires_Supprimer" boolean DEFAULT true,
"Affaires_Signer" boolean DEFAULT true,
"Affaires_Envoyer" boolean DEFAULT true,
"Affaires_Receptionner" boolean DEFAULT true,
"Affaires_Valider" boolean DEFAULT true,
"Affaires_Annuler" boolean DEFAULT true,
"Affaires_Imprimer" boolean DEFAULT true,
"Affaires_Avoir" boolean DEFAULT false,
"Affaires_RDV_Metre" boolean DEFAULT true,
"Affaires_RDV_Pose" boolean DEFAULT true,
"Affaires_RDV_SAV" boolean DEFAULT true,
"Affaires_Documents_Creer" boolean DEFAULT true,
"Affaires_Documents_Editer" boolean DEFAULT true,
"Affaires_Documents_Supprimer" boolean DEFAULT true,
"Fabrications" boolean DEFAULT true,
"Fabrications_Creer" boolean DEFAULT true,
"Fabrications_Editer" boolean DEFAULT true,
"Fabrications_Valider" boolean DEFAULT true,
"Fabrications_Supprimer" boolean DEFAULT true,
"Fabrications_Imprimer" boolean DEFAULT true,
"Expeditions" boolean DEFAULT true,
"Expeditions_Creer" boolean DEFAULT true,
"Expeditions_Editer" boolean DEFAULT true,
"Expeditions_Valider" boolean DEFAULT true,
"Expeditions_Supprimer" boolean DEFAULT true,
"Expeditions_Imprimer" boolean DEFAULT true,
"Expeditions_Scanner" boolean DEFAULT false,
"Factures" boolean DEFAULT true,
"Factures_Creer" boolean DEFAULT true,
"Factures_Editer" boolean DEFAULT true,
"Factures_Valider" boolean DEFAULT true,
"Factures_Comptabiliser" boolean DEFAULT true,
"Factures_Supprimer" boolean DEFAULT true,
"Factures_Imprimer" boolean DEFAULT true,
"Positions_Modification_Quantitees_Metre" boolean DEFAULT false,
"Positions_Modification_Quantitees_Fabrication" boolean DEFAULT false,
"Positions_Modification_Quantitees_Expedition" boolean DEFAULT false,
"Positions_Modification_Quantitees_Pose" boolean DEFAULT false,
"Positions_Modification_Quantitees_Facturation" boolean DEFAULT false
)
WITH (oids = false);
--
-- Structure for table utilisateurs_tableaux_bords (OID = 487206) :
--
CREATE TABLE public.utilisateurs_tableaux_bords (
"Utilisateur" varchar(25) DEFAULT ''::character varying NOT NULL,
"Id_Tableau_Bord" varchar(10) DEFAULT ''::character varying NOT NULL
)
WITH (oids = false);
--
-- Structure for table tableaux_bords (OID = 487219) :
--
CREATE TABLE public.tableaux_bords (
"Id_Tableau_Bord" varchar(20) DEFAULT ''::character varying NOT NULL,
"Id_Tableau_Bord_Categorie" varchar(20) DEFAULT ''::character varying NOT NULL,
"Tableau_Bord" varchar(200) DEFAULT ''::character varying NOT NULL,
"Description_Tableau_Bord" text DEFAULT ''::text,
"Actif" boolean DEFAULT true,
"SQL" text DEFAULT ''::text,
"Mot_De_Passe" varchar(10) DEFAULT ''::character varying,
"Date_Creation" timestamp(0) without time zone DEFAULT now(),
"Utilisateur" varchar(20) DEFAULT "current_user"(),
"Tableau_Bord_Type" varchar(20) DEFAULT ''::character varying,
"Document" bytea
)
WITH (oids = false);
ALTER TABLE ONLY public.tableaux_bords ALTER COLUMN "Id_Tableau_Bord" SET STATISTICS 0;
ALTER TABLE ONLY public.tableaux_bords ALTER COLUMN "Id_Tableau_Bord_Categorie" SET STATISTICS 0;
ALTER TABLE ONLY public.tableaux_bords ALTER COLUMN "Tableau_Bord" SET STATISTICS 0;
ALTER TABLE ONLY public.tableaux_bords ALTER COLUMN "Description_Tableau_Bord" SET STATISTICS 0;
--
-- Data for table public.utilisateurs (OID = 487120) (LIMIT 0,2)
--
INSERT INTO utilisateurs ("Utilisateur", "Mot_de_passe", "Id_Matricule", "Nom", "Prenom", "Date_Creation", "Heure_Creation", "Date_Dernier_Acces", "Heure_Dernier_Acces", "Nombre_Acces", "Actif", "Date_Desactivation", "Gestionnaire_Flux", "Gestionnaire_Impressions", "Gestionnaire_Tableaux_Bords", "Gestionnaire_Preferences", "Gestionnaire_Utilisateurs", "Gestionnaire_Structure_Organisationnelle", "Clients", "Clients_Creer", "Clients_Editer", "Clients_Bloquer", "Clients_Supprimer", "Clients_RDV_Commercial", "Clients_Imprimer", "Agendas", "Agendas_Creer", "Agendas_Editer", "Agendas_Supprimer", "Agendas_Imprimer", "Tableaux_Bords", "Tableaux_Bords_Exporter", "Documents", "Documents_Creer", "Documents_Editer", "Documents_Supprimer", "Reglements", "Reglements_Creer", "Reglements_Editer", "Reglements_Valider", "Reglements_Comptabiliser", "Reglements_Supprimer", "Reglements_Imprimer", "Affaires", "Affaires_Creer", "Affaires_Editer", "Affaires_Supprimer", "Affaires_Signer", "Affaires_Envoyer", "Affaires_Receptionner", "Affaires_Valider", "Affaires_Annuler", "Affaires_Imprimer", "Affaires_Avoir", "Affaires_RDV_Metre", "Affaires_RDV_Pose", "Affaires_RDV_SAV", "Affaires_Documents_Creer", "Affaires_Documents_Editer", "Affaires_Documents_Supprimer", "Fabrications", "Fabrications_Creer", "Fabrications_Editer", "Fabrications_Valider", "Fabrications_Supprimer", "Fabrications_Imprimer", "Expeditions", "Expeditions_Creer", "Expeditions_Editer", "Expeditions_Valider", "Expeditions_Supprimer", "Expeditions_Imprimer", "Expeditions_Scanner", "Factures", "Factures_Creer", "Factures_Editer", "Factures_Valider", "Factures_Comptabiliser", "Factures_Supprimer", "Factures_Imprimer", "Positions_Modification_Quantitees_Metre", "Positions_Modification_Quantitees_Fabrication", "Positions_Modification_Quantitees_Expedition", "Positions_Modification_Quantitees_Pose", "Positions_Modification_Quantitees_Facturation")
VALUES ('BOB.SENSER', '', '', 'SENSER', 'BOB', '2013-09-19', '14:36:16', '2013-09-19', '14:36:16', 0, true, NULL, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false);
INSERT INTO utilisateurs ("Utilisateur", "Mot_de_passe", "Id_Matricule", "Nom", "Prenom", "Date_Creation", "Heure_Creation", "Date_Dernier_Acces", "Heure_Dernier_Acces", "Nombre_Acces", "Actif", "Date_Desactivation", "Gestionnaire_Flux", "Gestionnaire_Impressions", "Gestionnaire_Tableaux_Bords", "Gestionnaire_Preferences", "Gestionnaire_Utilisateurs", "Gestionnaire_Structure_Organisationnelle", "Clients", "Clients_Creer", "Clients_Editer", "Clients_Bloquer", "Clients_Supprimer", "Clients_RDV_Commercial", "Clients_Imprimer", "Agendas", "Agendas_Creer", "Agendas_Editer", "Agendas_Supprimer", "Agendas_Imprimer", "Tableaux_Bords", "Tableaux_Bords_Exporter", "Documents", "Documents_Creer", "Documents_Editer", "Documents_Supprimer", "Reglements", "Reglements_Creer", "Reglements_Editer", "Reglements_Valider", "Reglements_Comptabiliser", "Reglements_Supprimer", "Reglements_Imprimer", "Affaires", "Affaires_Creer", "Affaires_Editer", "Affaires_Supprimer", "Affaires_Signer", "Affaires_Envoyer", "Affaires_Receptionner", "Affaires_Valider", "Affaires_Annuler", "Affaires_Imprimer", "Affaires_Avoir", "Affaires_RDV_Metre", "Affaires_RDV_Pose", "Affaires_RDV_SAV", "Affaires_Documents_Creer", "Affaires_Documents_Editer", "Affaires_Documents_Supprimer", "Fabrications", "Fabrications_Creer", "Fabrications_Editer", "Fabrications_Valider", "Fabrications_Supprimer", "Fabrications_Imprimer", "Expeditions", "Expeditions_Creer", "Expeditions_Editer", "Expeditions_Valider", "Expeditions_Supprimer", "Expeditions_Imprimer", "Expeditions_Scanner", "Factures", "Factures_Creer", "Factures_Editer", "Factures_Valider", "Factures_Comptabiliser", "Factures_Supprimer", "Factures_Imprimer", "Positions_Modification_Quantitees_Metre", "Positions_Modification_Quantitees_Fabrication", "Positions_Modification_Quantitees_Expedition", "Positions_Modification_Quantitees_Pose", "Positions_Modification_Quantitees_Facturation")
VALUES ('MEL.SENSER', '', '', 'SENSER', 'MEL', '2013-09-19', '14:36:16', '2013-09-19', '14:36:16', 0, true, NULL, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false);
--
-- Data for table public.utilisateurs_tableaux_bords (OID = 487206) (LIMIT 0,3)
--
INSERT INTO utilisateurs_tableaux_bords ("Utilisateur", "Id_Tableau_Bord")
VALUES ('MEL.SENSER', 'LOG0002');
INSERT INTO utilisateurs_tableaux_bords ("Utilisateur", "Id_Tableau_Bord")
VALUES ('MEL.SENSER', 'LOG0003');
INSERT INTO utilisateurs_tableaux_bords ("Utilisateur", "Id_Tableau_Bord")
VALUES ('MEL.SENSER', 'LOG0001');
--
-- Data for table public.tableaux_bords (OID = 487219) (LIMIT 0,1)
--
INSERT INTO tableaux_bords ("Id_Tableau_Bord", "Id_Tableau_Bord_Categorie", "Tableau_Bord", "Description_Tableau_Bord", "Actif", "SQL", "Mot_De_Passe", "Date_Creation", "Utilisateur", "Tableau_Bord_Type", "Document")
VALUES ('LOG0001', 'LOG', 'Historique', 'Historique des stock', true, '', '', '2013-11-26 15:58:15', '', '', '\\x');
--
-- Definition for index utilisateurs_new_idx (OID = 487211) :
--
CREATE INDEX utilisateurs_new_idx ON utilisateurs USING btree ("Id_Matricule");
--
-- Definition for index utilisateurs_new_idx1 (OID = 487212) :
--
CREATE INDEX utilisateurs_new_idx1 ON utilisateurs USING btree ("Actif");
--
-- Definition for index utilisateurs_tableaux_bords_idx1 (OID = 487213) :
--
CREATE INDEX utilisateurs_tableaux_bords_idx1 ON utilisateurs_tableaux_bords USING btree ("Utilisateur");
--
-- Definition for index utilisateurs_tableaux_bords_idx2 (OID = 487214) :
--
CREATE INDEX utilisateurs_tableaux_bords_idx2 ON utilisateurs_tableaux_bords USING btree ("Id_Tableau_Bord");
--
-- Definition for index tableaux_bords_idx (OID = 487235) :
--
CREATE INDEX tableaux_bords_idx ON tableaux_bords USING btree ("Id_Tableau_Bord_Categorie");
--
-- Definition for index tableaux_bords_idx1 (OID = 487236) :
--
CREATE INDEX tableaux_bords_idx1 ON tableaux_bords USING btree ("Actif");
--
-- Definition for index utilisateurs_new_pkey (OID = 487215) :
--
ALTER TABLE ONLY utilisateurs
ADD CONSTRAINT utilisateurs_new_pkey
PRIMARY KEY ("Utilisateur");
--
-- Definition for index utilisateurs_tableaux_bords_idx (OID = 487217) :
--
ALTER TABLE ONLY utilisateurs_tableaux_bords
ADD CONSTRAINT utilisateurs_tableaux_bords_idx
PRIMARY KEY ("Utilisateur", "Id_Tableau_Bord");
--
-- Definition for index Tableaux_Bords_pkey (OID = 487237) :
--
ALTER TABLE ONLY tableaux_bords
ADD CONSTRAINT "Tableaux_Bords_pkey"
PRIMARY KEY ("Id_Tableau_Bord");
--
-- Comments
--
COMMENT ON SCHEMA public IS 'standard public schema';Thank you
B.R.