Re: [GENERAL] Forward declaration of table

2016-08-25 Thread Alexander Farber
Thank you and apologies for the misformated mail - I kept fixing it for many minutes, but once I hit the "Send" button in Gmail it went south again.

Re: [GENERAL] Forward declaration of table

2016-08-24 Thread Adrian Klaver
On 08/24/2016 01:27 PM, Alexander Farber wrote: Hello again, I have went the ALTER TABLE route to add my 2 "cyclic" FKs: https://gist.github.com/afarber/c40b9fc5447335db7d24 And now I have these 2 tables in my 9.5.3 database: Why aren't m.tiles and m.score returned please? Reformatted

Re: [GENERAL] Forward declaration of table

2016-08-24 Thread David G. Johnston
On Wed, Aug 24, 2016 at 4:38 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Wed, Aug 24, 2016 at 4:27 PM, Alexander Farber < > alexander.far...@gmail.com> wrote: > >> >> Why aren't m.tiles and m.score returned please? >> >> > ​How about you output g.mid1 and g.mid2 in the first

Re: [GENERAL] Forward declaration of table

2016-08-24 Thread David G. Johnston
On Wed, Aug 24, 2016 at 4:27 PM, Alexander Farber < alexander.far...@gmail.com> wrote: > > Why aren't m.tiles and m.score returned please? > > ​How about you output g.mid1 and g.mid2 in the first query and confirm that the rows being returned from words_games actually have a value in the set

Re: [GENERAL] Forward declaration of table

2016-08-24 Thread Alexander Farber
Hello again, I have went the ALTER TABLE route to add my 2 "cyclic" FKs: https://gist.github.com/afarber/c40b9fc5447335db7d24 And now I have these 2 tables in my 9.5.3 database: #TABLE words_moves; mid | action | gid | uid |played |

Re: [GENERAL] Forward declaration of table

2016-08-23 Thread Igor Neyman
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Alexander Farber Sent: Tuesday, August 23, 2016 3:33 PM Cc: pgsql-general <pgsql-general@postgresql.org> Subject: Re: [GENERAL] Forward declaration of table Hi Igor, On Tue, Aug 23, 2016 at 8

Re: [GENERAL] Forward declaration of table

2016-08-23 Thread Alexander Farber
Hi Igor, On Tue, Aug 23, 2016 at 8:15 PM, Igor Neyman wrote: > mailto:pgsql-general-ow...@postgresql.org] *On Behalf Of *Alexander Farber > > https://gist.github.com/afarber/c40b9fc5447335db7d24 > > > > Certain MOVE exists only within particular GAME: no GAME -> no MOVE

Re: [GENERAL] Forward declaration of table

2016-08-23 Thread Igor Neyman
Regards, Igor From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Alexander Farber Sent: Tuesday, August 23, 2016 1:11 PM To: pgsql-general <pgsql-general@postgresql.org> Subject: [GENERAL] Forward declaration of table Good e

Re: [GENERAL] Forward declaration of table

2016-08-23 Thread Adrian Klaver
On 08/23/2016 10:29 AM, David G. Johnston wrote: On Tue, Aug 23, 2016 at 1:24 PM, Adrian Klaver >wrote: use ALTER TABLE ADD table_constraint : https://www.postgresql.org/docs/9.5/static/sql-altertable.html

Re: [GENERAL] Forward declaration of table

2016-08-23 Thread David G. Johnston
On Tue, Aug 23, 2016 at 1:24 PM, Adrian Klaver wrote: > > use ALTER TABLE ADD table_constraint : > > https://www.postgresql.org/docs/9.5/static/sql-altertable.html > > to add the FK references to word_games. > > ​Hadn't considered "ALTER TABLE" but I'd be afraid of

Re: [GENERAL] Forward declaration of table

2016-08-23 Thread David G. Johnston
On Tue, Aug 23, 2016 at 1:10 PM, Alexander Farber < alexander.far...@gmail.com> wrote: > > So my question is if I can somehow "forward declare" the words_moves table? > > ​A better way to phrase this is: Is it possible to create circular foreign key dependencies between tables? The answer is

Re: [GENERAL] Forward declaration of table

2016-08-23 Thread Adrian Klaver
On 08/23/2016 10:10 AM, Alexander Farber wrote: Good evening, with PostgreSQL 9.5.3 I am using the following table to store 2-player games: DROP TABLE IF EXISTS words_games; CREATE TABLE words_games ( gid SERIAL PRIMARY KEY, created timestamptz NOT NULL,

[GENERAL] Forward declaration of table

2016-08-23 Thread Alexander Farber
Good evening, with PostgreSQL 9.5.3 I am using the following table to store 2-player games: DROP TABLE IF EXISTS words_games; CREATE TABLE words_games ( gid SERIAL PRIMARY KEY, created timestamptz NOT NULL, player1 integer REFERENCES words_users(uid) ON DELETE CASCADE NOT