pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedForeign key constraint not enforced??
4+ messages / 2 participants
[nested] [flat]
* Foreign key constraint not enforced??
@ 2014-04-24 15:14 Moshe Jacobson <moshe@neadwerx.com>
2014-04-24 15:30 ` Re: Foreign key constraint not enforced?? Moshe Jacobson <moshe@neadwerx.com>
2014-04-24 15:34 ` Re: Foreign key constraint not enforced?? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 4+ messages in thread
From: Moshe Jacobson @ 2014-04-24 15:14 UTC (permalink / raw)
To: pgsql-bugs; +Cc: Robert Mowlavi <robert@neadwerx.com>
I'm not sure what is going on here. I feel like I'm missing something
obvious. Seems like a bug, so I'm posting on -bugs.
Please see the transcript below:
postgres@moshe=>isesdb:apache=# \d tb_error_log_event
Table "public.tb_error_log_event"
Column | Type |
Modifiers
----------------------+-----------------------------+-----------------------------------------------------
error_log_event | bigint | not null default
nextval('sq_pk_error_log_event'::r.
| |.egclass)
created | timestamp without time zone | not null default now()
logged | timestamp without time zone | not null
message_placeholders | integer[] |
error_log_message | bigint | not null
client_ip | inet | not null
server | integer | not null
domain | integer | not null
log_level | integer | not null
Indexes:
"tb_error_log_event_pkey" PRIMARY KEY, btree (error_log_event)
Foreign-key constraints:
"tb_error_log_event_domain_fkey" FOREIGN KEY (domain) REFERENCES
tb_domain(domain)
"tb_error_log_event_error_log_message_fkey" FOREIGN KEY
(error_log_message) REFERENCES tb_error_log_message(error_log_message)
"tb_error_log_event_log_level_fkey" FOREIGN KEY (log_level)
REFERENCES tb_log_level(log_level)
"tb_error_log_event_server_fkey" FOREIGN KEY (server) REFERENCES
tb_server(server)
Number of child tables: 1 (Use \d+ to list them.)
postgres@moshe=>isesdb:apache=# select error_log_event,
error_log_message from tb_error_log_event;
error_log_event | error_log_message
-----------------+-------------------
17 | 5
18 | 6
(2 rows)
Time: 0.853 ms
postgres@moshe=>isesdb:apache=# select * from tb_error_log_message;
error_log_message | message_body
-------------------+--------------------------------------------------------------------------------------
6 | test error log message ? ? ? ? ? ?-lalala ,
referer: http://ises.robert.neadwerx.co.
|.m/reports/reports.php
(1 row)
Time: 0.782 ms
postgres@moshe=>isesdb:apache=#
Surprisingly, I was able to pg_dump and pg_restore the database, and the
inconsistency remained!
Fortunately, also, I am able to share the pg_dump. You can download it here:
Binary dump: https://dl.dropboxusercontent.com/u/12192123/apache.pg_dump
Text dump: https://dl.dropboxusercontent.com/u/12192123/apache.pg_dump.sql
Thanks for any insight.
Moshe Jacobson
Manager of Systems Engineering, Nead Werx Inc. <http://www.neadwerx.com;
2323 Cumberland Parkway · Suite 201 · Atlanta, GA 30339
"Quality is not an act, it is a habit." -- Aristotle
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Foreign key constraint not enforced??
2014-04-24 15:14 Foreign key constraint not enforced?? Moshe Jacobson <moshe@neadwerx.com>
@ 2014-04-24 15:30 ` Moshe Jacobson <moshe@neadwerx.com>
1 sibling, 0 replies; 4+ messages in thread
From: Moshe Jacobson @ 2014-04-24 15:30 UTC (permalink / raw)
To: pgsql-bugs
On Thu, Apr 24, 2014 at 11:14 AM, Moshe Jacobson <moshe@neadwerx.com> wrote:
> Binary dump: https://dl.dropboxusercontent.com/u/12192123/apache.pg_dump
> Text dump: https://dl.dropboxusercontent.com/u/12192123/apache.pg_dump.sql
>
Forgot to mention, I am using PostgreSQL 9.3.3.
Moshe Jacobson
Manager of Systems Engineering, Nead Werx Inc. <http://www.neadwerx.com;
2323 Cumberland Parkway · Suite 201 · Atlanta, GA 30339
"Quality is not an act, it is a habit." -- Aristotle
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Foreign key constraint not enforced??
2014-04-24 15:14 Foreign key constraint not enforced?? Moshe Jacobson <moshe@neadwerx.com>
@ 2014-04-24 15:34 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-04-24 16:06 ` Re: Foreign key constraint not enforced?? Moshe Jacobson <moshe@neadwerx.com>
1 sibling, 1 reply; 4+ messages in thread
From: Tom Lane @ 2014-04-24 15:34 UTC (permalink / raw)
To: Moshe Jacobson <moshe@neadwerx.com>; +Cc: pgsql-bugs; Robert Mowlavi <robert@neadwerx.com>
Moshe Jacobson <moshe@neadwerx.com> writes:
> I'm not sure what is going on here. I feel like I'm missing something
> obvious. Seems like a bug, so I'm posting on -bugs.
Just guessing from the mention of child tables in the \d output:
you do realize that foreign key constraints don't bind child tables?
See "Caveats" at the bottom of
http://www.postgresql.org/docs/9.3/static/ddl-inherit.html
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Foreign key constraint not enforced??
2014-04-24 15:14 Foreign key constraint not enforced?? Moshe Jacobson <moshe@neadwerx.com>
2014-04-24 15:34 ` Re: Foreign key constraint not enforced?? Tom Lane <tgl@sss.pgh.pa.us>
@ 2014-04-24 16:06 ` Moshe Jacobson <moshe@neadwerx.com>
0 siblings, 0 replies; 4+ messages in thread
From: Moshe Jacobson @ 2014-04-24 16:06 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs; Robert Mowlavi <robert@neadwerx.com>
On Thu, Apr 24, 2014 at 11:34 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Just guessing from the mention of child tables in the \d output:
> you do realize that foreign key constraints don't bind child tables?
>
Bah! Yes, I knew that but had forgotten that this table had children.
Good eye and thank you.
I wish FK constraints were enforceable in child tables :-\
Moshe Jacobson
Manager of Systems Engineering, Nead Werx Inc. <http://www.neadwerx.com;
2323 Cumberland Parkway · Suite 201 · Atlanta, GA 30339
"Quality is not an act, it is a habit." -- Aristotle
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2014-04-24 16:06 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24 15:14 Foreign key constraint not enforced?? Moshe Jacobson <moshe@neadwerx.com>
2014-04-24 15:30 ` Moshe Jacobson <moshe@neadwerx.com>
2014-04-24 15:34 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-04-24 16:06 ` Moshe Jacobson <moshe@neadwerx.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox