I am relatively new to postgres (I am a django user - use pgsql via the orm), and I am trying to figure out a way to insert content into a specfic column - but so far, am not having any luck. So, I first have a database dzmodel_uf with two columns: id (which is the PK) and content - both of which are populated (say 50 entries).
Now, I would like to create another table, which references (foreign keys) to id of dzmodel_uf. So, I do the following:
--INITIALIZATION
CREATE TABLE MyNewTable(id integer REFERENCES dzmodel_uf (id));
ALTER TABLE ONLY FullTextSearch ADD CONSTRAINT mynewtable_pkey PRIMARY KEY (id);
which works fine. Now, I create a column on my MyNewTable table like so:
ALTER TABLE MyNewTable ADD COLUMN content_tsv_gin tsvector;
..which also works fine. Finally, I would like to add the content from dzmodel_uf - column content like so:
UPDATE MyNewTable SET content_tsv_gin = to_tsvector('public.wtf', dzmodel_uf(content) )
.. but this FAILS and says that column content does not exist..
In a nutshell, I am not sure how I can reference values from another table.
dzmodel_uf(content)has around 50 entries!UPDATEstatement or the table design? It's best to ask one clearly defined question. But first you need to learn the basics yourself.