Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to fetch data from a view in Postgres using Java/ Vaadin. But I get error that table do not have primary key. But Postgres donot support keys on view.

Can someone help on how to do that query?

share|improve this question
    
Hi, can anyone help here? –  Damandeep Thakur May 18 at 6:37
    
What are you trying to do? Vaadin view has no relevance to Postgre or any other database. Could you clarify your question? –  user3551612 May 18 at 8:33
1  
How do you access your database? With the sqlcontainer, jpa or..... –  André Schild May 19 at 6:18
    
@user3551612: it's either Postgres or PostgreSQL but never Postgre –  a_horse_with_no_name May 24 at 16:37

1 Answer 1

you can make key to primary key in postgres like this

ALTER TABLE table_name ADD CONSTRAINT table_name_pkey PRIMARY KEY (col1, col2);

EDIT Use this link for query on view: queries for postgresql view

share|improve this answer
    
The question is related to views; not tables. Can you suggest how to query on views? –  Damandeep Thakur May 17 at 19:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.