Thread: Some more questions on DB schema

Some more questions on DB schema

From
Alexey Borzov
Date:
Greetings.

1) What is the table 'dellog' for?
2) Why 'comments' table does not have a foreign key on 'docs'?


Re: Some more questions on DB schema

From
"Dave Page"
Date:

> -----Original Message-----
> From: Alexey Borzov [mailto:borz_off@cs.msu.su]
> Sent: 27 April 2004 15:35
> To: pgsql-www@postgresql.org
> Subject: [pgsql-www] Some more questions on DB schema
>
> Greetings.
>
> 1) What is the table 'dellog' for?

It's a leftover from the old search engine iirc. I assume there's noting
interesting in it? If not, it can go.

> 2) Why 'comments' table does not have a foreign key on 'docs'?

Oversight I guess. Feel free to add one.

Regards, Dave.

Re: Some more questions on DB schema

From
Alexey Borzov
Date:
Hi!

Dave Page wrote:
>>1) What is the table 'dellog' for?
>
> It's a leftover from the old search engine iirc. I assume there's noting
> interesting in it? If not, it can go.

Yep, the table is empty.

>>2) Why 'comments' table does not have a foreign key on 'docs'?
>
> Oversight I guess. Feel free to add one.

There are some problems with this... Run the following query

SELECT id, version, file
FROM comments c
WHERE NOT EXISTS (
     SELECT id
     FROM docs d
     WHERE d.version = c.version AND
           d.file = c.file
);

and observe the comments that are linked to non-existant pages of
documentation. Someone'll have to fix these before adding a foreign key
will be possible.



Re: Some more questions on DB schema

From
"Dave Page"
Date:

> -----Original Message-----
> From: Alexey Borzov [mailto:borz_off@cs.msu.su]
> Sent: 28 April 2004 13:39
> To: Dave Page
> Cc: pgsql-www@postgresql.org
> Subject: Re: [pgsql-www] Some more questions on DB schema
>
>
> There are some problems with this... Run the following query
>
> SELECT id, version, file
> FROM comments c
> WHERE NOT EXISTS (
>      SELECT id
>      FROM docs d
>      WHERE d.version = c.version AND
>            d.file = c.file
> );
>
> and observe the comments that are linked to non-existant
> pages of documentation. Someone'll have to fix these before
> adding a foreign key will be possible.

Fixed, fkey added.

Regards, Dave.