Questions about DataSet Wizard

Questions about DataSet Wizard

Postby CNPSV » Fri 02 Nov 2007 12:29

I have a database called "test" with 2 tables:
- clients : id (serial) (primary key), name (text)
- bills : id (serial) (primary key), date(date), id_client(integer) (foreign key)

I've used the DataSet Wizard witch sees the relationship, but when I try to preview the data I get this error: "requires the child key values to exist in the parent table"

P.S. I have correct records in both tables
CNPSV
 
Posts: 27
Joined: Thu 01 Nov 2007 09:48

Postby Alexey » Fri 02 Nov 2007 12:52

Please post the script to re-create your tables and data.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby CNPSV » Fri 02 Nov 2007 13:01

-- user: postgres, password: postgres
-- PostgreSQL database dump
--

-- Started on 2007-11-02 14:59:53

SET client_encoding = 'SQL_ASCII';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 1616 (class 1262 OID 17962)
-- Name: test; Type: DATABASE; Schema: -; Owner: postgres
--

CREATE DATABASE test WITH TEMPLATE = template0 ENCODING = 'SQL_ASCII';


ALTER DATABASE test OWNER TO postgres;

\connect test

SET client_encoding = 'SQL_ASCII';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 1617 (class 0 OID 0)
-- Dependencies: 4
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS 'Standard public schema';


--
-- TOC entry 266 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1274 (class 1259 OID 17975)
-- Dependencies: 4
-- Name: bills; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--

CREATE TABLE bills (
id integer NOT NULL,
date date,
id_client integer
);


ALTER TABLE public.bills OWNER TO postgres;

--
-- TOC entry 1273 (class 1259 OID 17973)
-- Dependencies: 1274 4
-- Name: bills_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE bills_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;


ALTER TABLE public.bills_id_seq OWNER TO postgres;

--
-- TOC entry 1619 (class 0 OID 0)
-- Dependencies: 1273
-- Name: bills_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE bills_id_seq OWNED BY bills.id;


--
-- TOC entry 1620 (class 0 OID 0)
-- Dependencies: 1273
-- Name: bills_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('bills_id_seq', 2, true);


--
-- TOC entry 1272 (class 1259 OID 17965)
-- Dependencies: 4
-- Name: clients; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--

CREATE TABLE clients (
id integer NOT NULL,
name text NOT NULL
);


ALTER TABLE public.clients OWNER TO postgres;

--
-- TOC entry 1271 (class 1259 OID 17963)
-- Dependencies: 1272 4
-- Name: clients_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE clients_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;


ALTER TABLE public.clients_id_seq OWNER TO postgres;

--
-- TOC entry 1621 (class 0 OID 0)
-- Dependencies: 1271
-- Name: clients_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE clients_id_seq OWNED BY clients.id;


--
-- TOC entry 1622 (class 0 OID 0)
-- Dependencies: 1271
-- Name: clients_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('clients_id_seq', 1, false);


--
-- TOC entry 1606 (class 2604 OID 17977)
-- Dependencies: 1273 1274 1274
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE bills ALTER COLUMN id SET DEFAULT nextval('bills_id_seq'::regclass);


--
-- TOC entry 1605 (class 2604 OID 17967)
-- Dependencies: 1272 1271 1272
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE clients ALTER COLUMN id SET DEFAULT nextval('clients_id_seq'::regclass);


--
-- TOC entry 1613 (class 0 OID 17975)
-- Dependencies: 1274
-- Data for Name: bills; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY bills (id, date, id_client) FROM stdin;
1 2007-02-02 1
2 2007-03-03 2
\.


--
-- TOC entry 1612 (class 0 OID 17965)
-- Dependencies: 1272
-- Data for Name: clients; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY clients (id, name) FROM stdin;
1 Name1
2 Name2
3 Name3
\.


--
-- TOC entry 1610 (class 2606 OID 17979)
-- Dependencies: 1274 1274
-- Name: bills_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--

ALTER TABLE ONLY bills
ADD CONSTRAINT bills_pkey PRIMARY KEY (id);


--
-- TOC entry 1608 (class 2606 OID 17972)
-- Dependencies: 1272 1272
-- Name: clients_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
--

ALTER TABLE ONLY clients
ADD CONSTRAINT clients_pkey PRIMARY KEY (id);


--
-- TOC entry 1611 (class 2606 OID 17980)
-- Dependencies: 1274 1272 1607
-- Name: bills_id_client_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY bills
ADD CONSTRAINT bills_id_client_fkey FOREIGN KEY (id_client) REFERENCES clients(id);


--
-- TOC entry 1618 (class 0 OID 0)
-- Dependencies: 4
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2007-11-02 14:59:53

--
-- PostgreSQL database dump complete
--
CNPSV
 
Posts: 27
Joined: Thu 01 Nov 2007 09:48

Postby Alexey » Fri 02 Nov 2007 13:31

How do you preview data?
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby CNPSV » Fri 02 Nov 2007 13:33

After I run the DataSet Wizard, when I click the dataset, I have a Preview... in Properties, and I get the above error
CNPSV
 
Posts: 27
Joined: Thu 01 Nov 2007 09:48

Postby Alexey » Fri 02 Nov 2007 13:46

Unfortunately, I couldn't reproduce the problem with your data.
Try to use emp and dept tables and see whether same problem occurs.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for PostgreSQL