Thank you for refering me to SQL::Abstract, this is where the WHERE clauses are documented. Furthermore, the suggested NOT IN works well, great!
Regarding the two cases listed in my question, I found that
  1. The proper code is $schema->resultset('my_table')->search({ id => {-in => [12,13,17]} }). Note that the r.h.s. of -in is an arrayref, not a string as I guessed initially.
  2. NOT is not yet possible. On SQL::Abstract, it is explained that there is not (yet) any explicit support for SQL compound logic statements like "AND NOT".

In reply to Re: SQL WHERE clauses with DBIx::Class, using NOT and IN by hrr
in thread SQL WHERE clauses with DBIx::Class, using NOT and IN by hrr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.