4
votes
Fortnightly Programming Q&A Thread
General Programming Q&A thread! Ask any questions about programming, answer the questions of other users, or post suggestions for future threads.
Don't forget to format your code using the triple backticks or tildes:
Here is my schema:
```sql
CREATE TABLE article_to_warehouse (
article_id INTEGER
, warehouse_id INTEGER
)
;
```
How do I add a `UNIQUE` constraint?
One of the annoying things about regex is that quite a few variants exist, and almost all of them have slightly different idiosyncrasies. In sed's case, one of them is that you have to escape curly brackets with a backslash. So it would need to be:
That's not quite right still though - the
\{3\}
makes it match exactly 3 numbers, but you want to match 1-3, so it should be\{1,3\}
:(You can also call sed with
-E
to use "extended regular expressions" so that the backslashes aren't needed and{1,3}
would have worked, but in the end it's just different idiosyncrasies)