where's the reference to a view, here?

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: where's the reference to a view, here?
Date: 2001-06-22 04:15:31
Message-ID: 20010621231531.A8988@serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

because of general weirdness, we translated all "--" in our original data
to "==" so postgres wouldn't drop it off as a comment (still haven't
figured that one out)...

to restore it to its original glory, we tried

inv=# update _invitem set descr=
inv-# substring(descr from 1 for position('==' in descr)-1)||'--'||substring(descr from position('==' in descr)+2)
inv-# where descr like '%==%';
ERROR: system column oid not available - inv is a view
inv=# \d _invitem
Table "_invitem"
Attribute | Type | Modifier
-----------+--------------+----------
id | integer |
item | smallint |
hrs | numeric(4,1) |
rate | numeric(6,2) |
other | numeric(7,2) |
descr | varchar(80) |

inv=# select count(*) from _invitem where descr like '%==%';
count
-------
45

there is a view named "inv" -- but how's that related to this
straght table update?

inv=# \d
List of relations
Name | Type | Owner
----------+-------+-------
_charge | table | will
_client | table | will
_inv | table | will
_invitem | table | will
_job | table | will
_work | table | will
inv | view | will
(7 rows)

inv=# \d inv
View "inv"
Attribute | Type | Modifier
-----------+----------------------+----------
client | varchar(8) |
id | integer |
code | varchar(20) |
rundate | date |
job | varchar(6) |
invdate | date |
costs | boolean |
total | numeric(7,2) |
item | smallint |
hrs | numeric(4,1) |
rate | numeric(6,2) |
other | numeric(7,2) |
descr | varchar(80) |
amt | numeric(65535,65531) |
View definition: SELECT b.client, b.id, b.code, b.rundate, b.job, b.invdate, b.costs, b.total, l.item, l.hrs, l.rate, l.other, l.descr, CASE WHEN (l.rate ISNULL) THEN l.other ELSE (l.rate * l.hrs) END AS amt FROM "_inv" b, "_invitem" l WHERE (b.id = l.id);

--
I figure: if a man's gonna gamble, may as well do it
without plowing. -- Bama Dillert, "Some Came Running"

will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Maxim Maletsky 2001-06-22 05:20:40 Does PostgreSQL support SET or ENUM data types?
Previous Message Lincoln Yeoh 2001-06-22 04:13:52 Re: Multiple Indexing, performance impact