ijdickinson
Reference data table in PostgreSQL schema
I have a collection of (basically static) reference data for my app, which is loaded separately into a Postgres schema reference_data. I want to query data from tables in that schema in my app’s Ecto queries. My first attempt was:
from parcel in "reference_data.living_england_habitat_map_phase_4",
select: [parcel.ogc_fid],
where: ...
When I run this query, I get an error:
[error] GenServer #PID<0.872.0> terminating
** (Postgrex.Error) ERROR 42P01 (undefined_table) relation "reference_data.living_england_habitat_map_phase_4" does not exist
query: SELECT r0."ogc_fid", r0."id", r0."a_pred", r0."b_pred", r0."geom" FROM "reference_data.living_england_habitat_map_phase_4" AS r0 WHERE ... LIMIT 10
The table does exist in that database, and I can query it from psql. If I swap the table reference to be a table in the public schema, I don’t get this error. So, if I’m understanding this correctly, I can’t access my reference_data schema table using:
from: parcel in "reference_data.living_england_habitat_map_phase_4",
because that generates as SQL
SELECT r0."ogc_fid" FROM "reference_data.living_england_habitat_map_phase_4"
instead of FROM reference_data.living_england_habitat_map_phase_4 without double-quotes.
What should I be doing instead?
Marked As Solved
al2o3cr
Also Liked
hauleth
Popular in Questions
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
Hi everyone,
I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
Hi!
Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
Other popular topics
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I’m writing a test for one of the...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









