Difference between revisions of "PostgreSQL view"

From gnewarchaeology wiki
Jump to: navigation, search
(Created page with "<yambe:breadcrumb>PostgreSQL|PostgreSQL</yambe:breadcrumb> __NOTOC__ == Create views with the geom column == * [] <syntaxhighlight lang="sql"> </syntaxhighlight> Cate...")
 
 
Line 9: Line 9:
  
 
<syntaxhighlight lang="sql">
 
<syntaxhighlight lang="sql">
 +
create view view_lithic_tool as select record, lithic_class, lithic_object, typo, blank, tool, retouch, comment from lithic where lithic_object = 'tool';
 +
</syntaxhighlight>
  
 +
== Update views ==
 +
 +
* []
 +
 +
 +
<syntaxhighlight lang="sql">
 +
create rule lithic_upd as on update to view_lithic_tool do instead update lithic set lithic_class = NEW.lithic_class where record = NEW.record;
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
[[Category:PostgreSQL]]
 
[[Category:PostgreSQL]]

Latest revision as of 10:53, 25 January 2016

PostgreSQL > PostgreSQL view



Create views with the geom column

  • []


create view view_lithic_tool as select record, lithic_class, lithic_object, typo, blank, tool, retouch, comment from lithic where lithic_object = 'tool';

Update views

  • []


create rule lithic_upd as on update to view_lithic_tool do instead update lithic set lithic_class = NEW.lithic_class where record = NEW.record;