<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="151587" data-post-id="151587">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="darinwilson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/darinwilson/120/15104_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  darinwilson
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Programming Ecto</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for the nice feedback <a class="mention" href="/u/neuone" rel="nofollow">@neuone</a> - I’m glad you found the book helpful!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="151587" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/48">Post #47</a>
	                </div>
	            </div>
              <div id="likers-container-151587" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="151587"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #47"></div>
  </section>
</div>
    <div class="postbit" id="183230" data-post-id="183230">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jmurphyweb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jmurphyweb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>When running snippets in the programming ecto <code>code</code> project, I keep getting a strange error message:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(1)&gt; Repo.insert(%Genre{name: "speed polka"})
# {:ok, %MusicDB.Genre{...}}

iex(2)&gt; Repo.insert(%Genre{name: "speed polka"})
# ** (MatchError) no match of right hand side value: []
</code></pre>
<p>If I run code via the <code>playground</code> module, then I get the actual error message.</p>
<p>In a different project I get proper ecto error messages when in IEX shell. Can anyone suggest what might be going on?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="183230" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/49">Post #48</a>
	                </div>
	            </div>
              <div id="likers-container-183230" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="183230"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #48"></div>
  </section>
</div>
    <div class="postbit" id="185652" data-post-id="185652">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jmurphyweb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jmurphyweb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/darinwilson" rel="nofollow">@darinwilson</a> any thoughts on this ? <img src="https://forum.elixirforum.com/images/emoji/apple/point_up.png?v=15" title=":point_up:" class="emoji" alt=":point_up:" loading="lazy" width="20" height="20"></p>
<p>To clarify, all DB level errors are returned as this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">** (MatchError) no match of right hand side value: []
</code></pre>
<p>So the first insert works fine, but the second fails a unique constraint but returns an unusual error message.</p>
<p>To reiterate, any failing operation that I run in the playground, it correctly returns the standard error message.</p>
<hr>
<p>Another example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(5)&gt; Repo.insert(%MusicDB.Artist{})
** (MatchError) no match of right hand side value: []
# 13:01:08.566 [debug] QUERY ERROR db=0.7ms queue=3.1ms
# INSERT INTO "artists" ("inserted_at","updated_at") VALUES ($1,$2) RETURNING "id" [~N[2020-08-09 11:01:08], ~N[2020-08-09 11:01:08]]
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="185652" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/50">Post #49</a>
	                </div>
	            </div>
              <div id="likers-container-185652" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="185652"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #49"></div>
  </section>
</div>
    <div class="postbit" id="185777" data-post-id="185777">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="darinwilson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/darinwilson/120/15104_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  darinwilson
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Programming Ecto</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi <a class="mention" href="/u/jmurphyweb" rel="nofollow">@jmurphyweb</a> <img src="https://forum.elixirforum.com/images/emoji/apple/wave.png?v=15" title=":wave:" class="emoji" alt=":wave:" loading="lazy" width="20" height="20"></p>
<p>What version of Elixir/Erlang are you using? I tried the example using Elixir 1.9 and Erlang 21.3.7 and I got the expected behavior in IEx, i.e. it showed the full error message:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(3)&gt; Repo.insert(%Genre{name: "speed polka"})

09:17:52.517 [debug] QUERY ERROR db=2.9ms queue=0.5ms
INSERT INTO "genres" ("name","inserted_at","updated_at") VALUES ($1,$2,$3) RETURNING "id" ["speed polka", ~N[2020-08-10 16:17:52], ~N[2020-08-10 16:17:52]]
** (Ecto.ConstraintError) constraint error when attempting to insert struct:

    * genres_name_index (unique_constraint)
...
</code></pre>
<p>If you’re on Elixir 1.10, maybe something changed in IEx that’s triggering different behavior. Or is it possible that you have a global <code>.iex.exs</code> that’s modifying the behavior? I’m a little stumped, so I’m just guessing here… <img src="https://forum.elixirforum.com/images/emoji/apple/confused.png?v=15" title=":confused:" class="emoji" alt=":confused:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="185777" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/51">Post #50</a>
	                </div>
	            </div>
              <div id="likers-container-185777" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="185777"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #50"></div>
  </section>
</div>
    <div class="postbit" id="185825" data-post-id="185825">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jmurphyweb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jmurphyweb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I dropped down to elixir 1.9 and ran it but had the same result.<br>
I’ve never set up a global <code>.iex.exs</code> file.</p>
<p>I’ll try a fresh install of the project and re-run it.</p>
<hr>
<p>Fresh install works fine. No idea what I did on the old one… Thanks <a class="mention" href="/u/darinwilson" rel="nofollow">@darinwilson</a></p>
<hr>
<p>Strangely enough when I moved the project back into my <code>programming-ecto</code> subdirectory the problem re-occurred. Moving the project back out and all is well again. I can’t understand why that happens but happy to ignore now it’s working again <img src="https://forum.elixirforum.com/images/emoji/apple/+1.png?v=15" title=":+1:" class="emoji" alt=":+1:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="185825" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/52">Post #51</a>
	                </div>
	            </div>
              <div id="likers-container-185825" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="185825"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #51"></div>
  </section>
</div>
    <div class="postbit" id="185861" data-post-id="185861">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="darinwilson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/darinwilson/120/15104_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  darinwilson
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Programming Ecto</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Huh - that’s really strange.</p>
<p>Well, I guess it’s not quite “mystery solved” but I’m glad it’s at least “mystery REsolved” <img src="https://forum.elixirforum.com/images/emoji/apple/smile.png?v=15" title=":smile:" class="emoji" alt=":smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="185861" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/53">Post #52</a>
	                </div>
	            </div>
              <div id="likers-container-185861" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="185861"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #52"></div>
  </section>
</div>
    <div class="postbit" id="268620" data-post-id="268620">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vgrechin" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vgrechin/120/26214_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vgrechin
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Encounter the problem when I run the seed.exs</p>
<p>Interestingly, it looks like the data were loaded few steps before the seed (probably, automatically when I invoke <em>ecto create</em>?)<br>
So I’m able to count the loaded records from console</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(1)&gt; MusicDB.Repo.aggregate("artists", :count, :id)
22:56:04.664 [debug] QUERY OK source="artists" db=6.0ms decode=4.0ms queue=7.8ms idle=449.8ms
SELECT count(a0."id") FROM "artists" AS a0 []
3
</code></pre>
<p>Hence the message signals I’m inserting there duplicates? Or what?</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">
$ mix run priv/repo/seeds.exs 
warning: use Mix.Config is deprecated. Use the Config module instead
  config/config.exs:11

warning: use Mix.Config is deprecated. Use the Config module instead
  config/dev.exs:9


22:31:28.937 [debug] QUERY ERROR db=24.7ms queue=4.3ms idle=10.2ms
INSERT INTO "genres" ("name","wiki_tag","inserted_at","updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" ["jazz", "Jazz", ~N[2022-11-17 19:31:28], ~N[2022-11-17 19:31:28]]
** (Ecto.ConstraintError) constraint error when attempting to insert struct:

    * genres_name_index (unique_constraint)

If you would like to stop this constraint violation from raising an
exception and instead add it as an error to your changeset, please
call `unique_constraint/3` on your changeset with the constraint
`:name` as an option.

The changeset has not defined any constraint.

    (ecto 3.9.1) lib/ecto/repo/schema.ex:795: anonymous fn/4 in Ecto.Repo.Schema.constraints_to_errors/3
    (elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (ecto 3.9.1) lib/ecto/repo/schema.ex:780: Ecto.Repo.Schema.constraints_to_errors/3
    (ecto 3.9.1) lib/ecto/repo/schema.ex:761: Ecto.Repo.Schema.apply/4
    (ecto 3.9.1) lib/ecto/repo/schema.ex:369: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    (ecto 3.9.1) lib/ecto/repo/schema.ex:265: Ecto.Repo.Schema.insert!/4
    priv/repo/seeds.exs:12: (file)
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="268620" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/54">Post #53</a>
	                </div>
	            </div>
              <div id="likers-container-268620" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="268620"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #53"></div>
  </section>
</div>
    <div class="postbit" id="300520" data-post-id="300520">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ajur58" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ajur58/120/33928_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ajur58
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>For anyone still following this thread - how relevant is the book now that it’s 4+ years past release? Are many parts outdated or is it still a good reference for someone new to Ecto?</p>
<p>The official docs are good and I can pick up the basics, but would be interested in the advanced parts, how to use Ecto in a real-world app - more or less in line with what I’ve read from the book’s table of contents. Thanks!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="300520" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/55">Post #54</a>
	                </div>
	            </div>
              <div id="likers-container-300520" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="300520"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #54"></div>
  </section>
</div>
    <div class="postbit" id="300522" data-post-id="300522">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="KiKi" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  KiKi
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yes, the book is most definitely relevant today. I still read some parts from time to time. Ecto hasn’t changed much, new features have been added but that’s about it.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="300522" data-batch-url="/posts/batch_likers">
                        5
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/56">Post #55</a>
	                </div>
	            </div>
              <div id="likers-container-300522" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="300522"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #55"></div>
  </section>
</div>
    <div class="postbit" id="300808" data-post-id="300808">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="joaquinalcerro" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joaquinalcerro/120/13928_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  joaquinalcerro
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I do think Programming Ecto is still relevant today but you might want to checkout the Dashbit’s book “The Little Ecto Cookbook” which has some advanced topics and it is relevant for Ecto 3.10 and later as the author says… as a bonus, it’s free.</p>
<p>You can find the book here: <a href="https://dashbit.co/ebooks/the-little-ecto-cookbook" class="inline-onebox" rel="noopener nofollow ugc">The Little Ecto Cookbook - Dashbit ebooks</a></p>
<p>Best regards,</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="300808" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/programming-ecto-pragprog/13287/57">Post #56</a>
	                </div>
	            </div>
              <div id="likers-container-300808" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="300808"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>