This is currently unimplemented (and returns an error) but I don't think it would be hard to add. There's no worry about violating the constraint since the column is new.
It also points to #8855, but that's not the correct issue. So I'll send a PR to update the issue number to this one.
Assigning @vivekmenezes for triage.
This is needed for https://github.com/cockroachdb/cockroach/issues/5582 right?
@awoods187 this looks like a small effort.
For what it's worth, I just hit this while writing a migration for the managed service console. Would be nice to support.
@awoods187 can you help me understand the relative urgency of this? It sounds like it would help us add foreign keys transactionally but I'm not sure how much that buys us for ORM compat.
I'm not sure--it was needed for compat but a lot of work has changed here with FKs and ORMs. @jordanlewis do you know?
It's still unimplemented and therefore still another minor incompatibility that prevents apps from working without modification between PG and CRDB. It's far from the only one of these, but if it's a small effort, implementing it generally is worth it.
Is it possible to find an owner for this and prioritize this?
Would be great to know if there are plans to implement this :)
Is there any way I can bump the priority on this?
@fire could you expand a bit more on why this would be valuable to you?
Not op, but I’ve been following this issue for a while when attempting to to use a CockroachDB via the Elixir Postgrex library.
I believe this feature request is for PostgresDB default compatibility.
The Elixir Ecto library and Postgrex connection library use this functionality to perform database migrations to alter an existing table when changes are made - explicitly for column foreign / primary key reference changes to other columns.
There is a (currently manual) workaround to rename the column, create a new column with the correct references, then copy over the column data and delete the old column - so at least speaking for my case it is a convenience feature request.
Cheers,
Cohee
On Jan 31, 2020, at 4:37 PM, Andy Woods notifications@github.com wrote:

@fire could you expand a bit more on why this would be valuable to you?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
https://github.com/cockroachdb/cockroach/issues/32917#issuecomment-580944849 Described better what I wanted, but my frustration is that CockroachDB isn't able to run migrations in Elixir Ecto's orm automatically.
Coding the manual workaround means I dropped using CockroachDB.
I'd like to tackle this soon. cc @rohany
Just to clarify this is just adding a foreign key constraint on the column right
Nice!
o/
Most helpful comment
Not op, but I’ve been following this issue for a while when attempting to to use a CockroachDB via the Elixir Postgrex library.
I believe this feature request is for PostgresDB default compatibility.
The Elixir Ecto library and Postgrex connection library use this functionality to perform database migrations to alter an existing table when changes are made - explicitly for column foreign / primary key reference changes to other columns.
There is a (currently manual) workaround to rename the column, create a new column with the correct references, then copy over the column data and delete the old column - so at least speaking for my case it is a convenience feature request.
Cheers,
Cohee