pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16407: Column mismatch
2+ messages / 2 participants
[nested] [flat]
* BUG #16407: Column mismatch
@ 2020-05-01 14:38 PG Bug reporting form <noreply@postgresql.org>
2020-05-01 16:34 ` Re: BUG #16407: Column mismatch David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2020-05-01 14:38 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: onlinejudge95@gmail.com
The following bug has been logged on the website:
Bug reference: 16407
Logged by: onlinejudge95
Email address: onlinejudge95@gmail.com
PostgreSQL version: 12.2
Operating system: Docker
Description:
I have a flask app that connects to a Postgres DB and stores the user info
there.
For local development purposes, I am using docker to bring up 2 containers
one my app and the other of Postgres.
In my models, I am defining my primary key as a column named id
class User(db.Model):
__tablename__ = "users"
_id = db.Column(UUID(as_uuid=True), primary_key=True, unique=True,
nullable=False,)
username = db.Column(db.String(128), nullable=False)
email = db.Column(db.String(128), nullable=False)
def __init__(self, username, email):
self._id = uuid.uuid4().hex
self.username = username
self.email = email
Everything works fine in my local system when I use this Dockerfile
FROM postgres:12.2
LABEL maintainer="onlinejudge95"
COPY configs/db.sql /docker-entrypoint-initdb.d/
But while deploying to Heroku and using the Postgre image there, I receive
the following errors on any operation that queries my DB.
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column
users.id does not exist
So I decided to change my models to use _id instead of id, this change seems
to work fine.
Is this a known discrepancy?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #16407: Column mismatch
2020-05-01 14:38 BUG #16407: Column mismatch PG Bug reporting form <noreply@postgresql.org>
@ 2020-05-01 16:34 ` David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: David G. Johnston @ 2020-05-01 16:34 UTC (permalink / raw)
To: onlinejudge95@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Fri, May 1, 2020 at 8:28 AM PG Bug reporting form <noreply@postgresql.org>
wrote:
> The following bug has been logged on the website:
>
> Bug reference: 16407
> Logged by: onlinejudge95
> Email address: onlinejudge95@gmail.com
> PostgreSQL version: 12.2
> Operating system: Docker
> Description:
>
> I have a flask app that connects to a Postgres DB and stores the user info
> there.
> For local development purposes, I am using docker to bring up 2 containers
> one my app and the other of Postgres.
> In my models, I am defining my primary key as a column named id
>
>
> Everything works fine in my local system when I use this Dockerfile
>
> FROM postgres:12.2
>
>
> So I decided to change my models to use _id instead of id, this change
> seems
> to work fine.
> Is this a known discrepancy?
>
This is a bug report mailing list - what you are describing doesn't seem
like a bug - it doesn't even seem like something the PostgreSQL server is
responsible for. Given what does work locally doesn't work on Heroku you
should probably ask them.
However, you posted the following while claiming to have named your column
"id"...
_id = db.Column(UUID(as_uuid=True), primary_key=True, unique=True,
self._id = uuid.uuid4().hex
Maybe your local development copy has some unwanted data within it that
causing it not to fail and when you deploy to a clean Heroku instance the
discrepancy comes to light?
David J.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-05-01 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 14:38 BUG #16407: Column mismatch PG Bug reporting form <noreply@postgresql.org>
2020-05-01 16:34 ` David G. Johnston <david.g.johnston@gmail.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