iangow/activist_director

Fix issue with campaign_ids

Closed this issue · 5 comments

So when I am running ‘table_selection.Rnw’ I bump into this error at Line 76.

Error in postgresqlExecStatement(conn, statement, ...) :
  RS-DBI driver: (could not Retrieve the result : ERROR:  op ANY/ALL (array) requires array on right side
LINE 11:     ON a.campaign_id=any(b.campaign_ids)
                            ^

I believe this is due to a difference in “class” between ‘activist_director.activist_director_skills$campaign_id’ and ‘activist_director.demands$campaign_ids’. Do you think this difference comes from activist_director.demands being created on R first and then pushed to your SQL server?

FYI, activist_director.demands comes from ‘create_activist_demands.R’ and activist_director.activist_director_skills comes from ‘imoprt_activist_director_skills.R’.

@sapyung Where is the code that creates activist_director.demands?

@sapyung Where is the code that creates activist_director.demands?

/code/create_activist_demands.R.

@sapyung Let me know if the commit above addresses the issue. I ran the code on iangow.me at port 5432 only.

igow@Mac-Pro ~ % psql -d crsp
psql (12.4)
Type "help" for help.

crsp=# \d+ activist_director.demands 
                                       Table "activist_director.demands"
          Column           |   Type    | Collation | Nullable | Default | Storage  | Stats target | Description 
---------------------------+-----------+-----------+----------+---------+----------+--------------+-------------
 campaign_ids              | integer[] |           |          |         | extended |              | 
 strategy_demand           | boolean   |           |          |         | plain    |              | 
 merger_demand             | boolean   |           |          |         | plain    |              | 
 block_merger_demand       | boolean   |           |          |         | plain    |              | 
 acquisition_demand        | boolean   |           |          |         | plain    |              | 
 block_acquisition_demand  | boolean   |           |          |         | plain    |              | 
 divestiture_demand        | boolean   |           |          |         | plain    |              | 
 payout_demand             | boolean   |           |          |         | plain    |              | 
 leverage_demand           | boolean   |           |          |         | plain    |              | 
 reits_demand              | boolean   |           |          |         | plain    |              | 
 board_seat_demand         | boolean   |           |          |         | plain    |              | 
 remove_director_demand    | boolean   |           |          |         | plain    |              | 
 add_indep_demand          | boolean   |           |          |         | plain    |              | 
 remove_officer_demand     | boolean   |           |          |         | plain    |              | 
 remove_defense_demand     | boolean   |           |          |         | plain    |              | 
 compensation_demand       | boolean   |           |          |         | plain    |              | 
 other_gov_demand          | boolean   |           |          |         | plain    |              | 
 esg_demand                | boolean   |           |          |         | plain    |              | 
 strategy_outcome          | boolean   |           |          |         | plain    |              | 
 merger_outcome            | boolean   |           |          |         | plain    |              | 
 block_merger_outcome      | boolean   |           |          |         | plain    |              | 
 acquisition_outcome       | boolean   |           |          |         | plain    |              | 
 block_acquisition_outcome | boolean   |           |          |         | plain    |              | 
 divestiture_outcome       | boolean   |           |          |         | plain    |              | 
 payout_outcome            | boolean   |           |          |         | plain    |              | 
 leverage_outcome          | boolean   |           |          |         | plain    |              | 
 reits_outcome             | boolean   |           |          |         | plain    |              | 
 board_seat_outcome        | boolean   |           |          |         | plain    |              | 
 remove_director_outcome   | boolean   |           |          |         | plain    |              | 
 add_indep_outcome         | boolean   |           |          |         | plain    |              | 
 remove_officer_outcome    | boolean   |           |          |         | plain    |              | 
 remove_defense_outcome    | boolean   |           |          |         | plain    |              | 
 compensation_outcome      | boolean   |           |          |         | plain    |              | 
 other_gov_outcome         | boolean   |           |          |         | plain    |              | 
 esg_outcome               | boolean   |           |          |         | plain    |              | 
Access method: heap

crsp=# 

Now I am stuck at Line 138 of table_selection.Rnw for a similar reason.

Error in postgresqlExecStatement(conn, statement, ...) : 
  RS-DBI driver: (could not Retrieve the result : ERROR:  operator does not exist: text = text[]
LINE 5: ... = "RHS"."dissident_group" AND "LHS"."dissidents" = "RHS"."d...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

I am not sure why this is happening, but I was wondering if this could come from some differences between Linux vs. Mac version of R (really just guessing).

I am not sure why this is happening, but I was wondering if this could come from some differences between Linux vs. Mac version of R (really just guessing).

Not likely. If the earlier issue is fixed, close this one and make a new one. It would help if you could identify the underlying tables for dissidents in the LHS and RHS match being attempted above (and link to the code that generates them).