0

In postgres, I have generated table user and table organizations. There is some relationship between them, i.e.: multiple users belong to one organization.

The table user_organizations_organization was auto-generated by postgres.

Here I have:

development=# select * from user_organizations_organization;
 userId | organizationId 
--------+----------------
      1 |              1
      2 |              1
      3 |              2
      4 |              2
      5 |              1
      6 |              1
      7 |              2
      8 |              2
      9 |              3
     10 |              3
     11 |              4
     12 |              4
     13 |              3
     14 |              3
     15 |              4
     16 |              4
     17 |              5
     18 |              5
     19 |              6
     20 |              6
     21 |              5
     22 |              5
     23 |              6
     24 |              6
     25 |              7
     26 |              7
     27 |              8
     28 |              8
     29 |              7
     30 |              7
     31 |              8
     32 |              8
     33 |              9
     34 |              9
     35 |             10
     36 |             10
     37 |              9
     38 |              9
     39 |             10
     40 |             10
(40 rows)

I want to delete relationships related to organizations 5,6,7,8:

development=# delete from user_organizations_organization where organizationId in (5,6,7,8);
ERROR:  column "organizationid" does not exist
LINE 1: delete from user_organizations_organization where organizati...
                                                          ^
HINT:  Perhaps you meant to reference the column "user_organizations_organization.organizationId".
development=# 

How can I delete them?

a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843
Kid_Learning_C
  • 1,724
  • 2
  • 18
  • 31
  • 1
    You need to quote your identifier `"organizationId"` unquoted identfiers are considered all lowercase. – Eelke Apr 11 '22 at 09:50

0 Answers0