django-sharding icon indicating copy to clipboard operation
django-sharding copied to clipboard

I've tried migrated 32-bit id field to PostgresShardForeignKey

Open M1ha-Shvn opened this issue 7 years ago • 3 comments

I've tried migrated 32-bit id field to PostgresShardForeignKey And got error:

django.db.utils.ProgrammingError: syntax error at or near "DEFAULT"
LINE 1: ...sages_conversation" ALTER COLUMN "id" TYPE bigint DEFAULT ne...

Here is what manage.py sqlmigrate command shows:

ALTER TABLE "messages_messagesending" 
ALTER COLUMN "id" TYPE bigint DEFAULT next_sharded_id()
 USING "id"::bigint
 
-- What's this for?
DEFAULT next_sharded_id();

M1ha-Shvn avatar Dec 13 '17 08:12 M1ha-Shvn

Are you sure it was that one, PostgresShardGeneratedIDAutoField uses that default but PostgresShardForeignKey doesn't use that from what I can see.

JBKahn avatar Feb 11 '18 18:02 JBKahn

It's been 2 months since this issue was created =) I don't even remember where I caught it. But I guess you are right, as tables' id field is shown in the query, not foreign key to sharding model.

M1ha-Shvn avatar Feb 12 '18 07:02 M1ha-Shvn

Sorry about that, did a bunch of my other maintainer stuff this past weekend so I'll see what I can do for this one maybe this weekend.

JBKahn avatar Feb 12 '18 14:02 JBKahn