[SQL] table permissions

2001-11-01 Thread Oleg Lebedev
Hi everybody, I can't seem to figure this one out. I have a superuser root and a regular user oleg. I am trying to insert a new row in table Set, which references table Activity, being logged in as root. I get an error saying: activity: Permission denied. This is very weird because root has all th

Re: [SQL] PL/pgSQL syntax for strings

2001-11-01 Thread Roberto Mello
On Thu, Nov 01, 2001 at 04:48:29PM +, Edward Grabczewski wrote: > > DROP FUNCTION threedpoint (float,float,float, float,float,float); > CREATE FUNCTION threedpoint (float,float,float,float,float,float) > RETURNS text > AS 'DECLARE > x1 ALIAS FOR $1; > y1 ALIAS FOR $2; > z1 A

Re: [SQL] Error 34526 - cache lookup failed

2001-11-01 Thread Stephan Szabo
On Thu, 1 Nov 2001, Sandro Joel Eller wrote: > Always I execute the SQL > > insert into questionarios (codigo, descricao) values (10, 'Basico') > > happen the error below. Do Anybody know what is happened? > > Error - /var/www/html/tecWEB/pgadmin/sql.php -- Line: 107 > PostgreSQL said: ERROR: fmg

Re: [SQL] Aggregate binary AND

2001-11-01 Thread Tom Lane
"James Orr" <[EMAIL PROTECTED]> writes: > Is there an aggregate binary AND function in postgres? If not, is there a > way to write your own aggregate functions? Examples? The aggregate would be trivial given an underlying two-argument AND function to build it from: regression=# create aggregat

[SQL] Error 34526 - cache lookup failed

2001-11-01 Thread Sandro Joel Eller
Always I execute the SQL insert into questionarios (codigo, descricao) values (10, 'Basico') happen the error below. Do Anybody know what is happened? Error - /var/www/html/tecWEB/pgadmin/sql.php -- Line: 107 PostgreSQL said: ERROR: fmgr_info: function 34526: cache lookup failed Your query:

[SQL] Sorry for blocking email

2001-11-01 Thread Bruce Momjian
My spam filter was misconfigured and I bounced back some messages I shouldn't have. Sorry. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your

Re: [SQL] Aggregate binary AND

2001-11-01 Thread Philip Hallstrom
This worked for us in 7.something (don't need it anymore, but it should still work). You'll want to create one for INT8, INT2, etc.. if you are going to use those as well... CREATE AGGREGATE aggr_bitand ( BASETYPE = INT4, SFUNC1 = int4and, STYPE1 = INT4); On Thu, 1 Nov 2001, James Orr wrote: >

Re: [SQL] How to use BYTEA type?

2001-11-01 Thread Joe Conway
Christopher Sawtell wrote: > Greetings folks, > > Please could a kind soul tell be how to extract data from a BYTEA type of > field into a file, or better still tell me where I can find some doco? Bruce has already written some minimal documentation which is in the 7.2 beta. I'm hoping t

Re: [SQL] transposing data for a view

2001-11-01 Thread Jeff Eckermann
--- James Orr <[EMAIL PROTECTED]> wrote: > I think he might be talking about mine. The region > values will not be > duplicated, the WHERE clause prevents it. If you are saying that I didn't read the original query closely enough, you're probably right. Unfortunately I deleted the original me

[SQL] Aggregate binary AND

2001-11-01 Thread James Orr
Hi, Is there an aggregate binary AND function in postgres? If not, is there a way to write your own aggregate functions? Examples? - James ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-loun

Re: [SQL] transposing data for a view

2001-11-01 Thread James Orr
> > BTW, I don't believe the self-join approach proposed > > earlier will work, because joining on "scanid" will > > create a cartesian type join where the region values > > will be duplicated (multiplicated!). > > Not if you're talking about my query, they won't. I use that query form > in many

[SQL] PL/pgSQL syntax for strings

2001-11-01 Thread Edward Grabczewski
Could someone please tell me the correct syntax for the following problem in plpgsql: The following expression code sample works but now (for example) I'd like to subsitute the variables $1 and $2 for the numbers 0 and 2 in the following expression: INSERT INTO rtest(xz,yz,xy) VALUES ( \'(0,2),

Re: [SQL] transposing data for a view

2001-11-01 Thread Josh Berkus
Jeff, > I don't see how you got the result you quote below. > My query sums the volume figures, grouping by scanid: > that worked as expected (one line per scanid) on my > system when I tested it (version 7.1.2, though I don't > think that matters). Lemme try it Yes, you're right. Sorry!

Re: [SQL] How to use BYTEA type?

2001-11-01 Thread Stephan Szabo
On Thu, 1 Nov 2001, Radu-Adrian Popescu wrote: > Doing > > template1=> SELECT proname from pg_proc ; > proname > > boolin > boolout > byteain > byteaout > > you can see there is a byteaout function also. However, these are > undocumented in the interactive do

Re: [SQL] transposing data for a view

2001-11-01 Thread Jeff Eckermann
Josh, I don't see how you got the result you quote below. My query sums the volume figures, grouping by scanid: that worked as expected (one line per scanid) on my system when I tested it (version 7.1.2, though I don't think that matters). Jeff --- Josh Berkus <[EMAIL PROTECTED]> wrote: > Of co

Re: [SQL] View consistency

2001-11-01 Thread Stephan Szabo
On Thu, 1 Nov 2001, David M. Richter wrote: > Hello! > > Im using several views for the Usermanagment of a database. > My question is: > > How does postgres keep the views consistent to the according tables( if > the original table has been changed)? AFAIK it's a select rule on the view that rew

Re: [SQL] transposing data for a view

2001-11-01 Thread Josh Berkus
Jeremy, > I see how your idea could work--the only thing I would change would > be region needs to be scanid on the first line; however, > I'm using PostgreSQL v7.03, so I can not do subqueries within FROM > clause. > > Other than creating a temporary table, is there a way to > restructure this

Re: [SQL] transposing data for a view

2001-11-01 Thread Josh Berkus
Jeff, > SELECT >scanid, >sum ( CASE WHEN region = 'A' THEN volume ELSE NULL > ) > AS A_volume, >sum ( CASE WHEN region = 'B' THEN volume ELSE NULL > ) > AS B_volume, >sum ( CASE WHEN region = 'C' THEN volume ELSE NULL > ) > AS C_volume > FROM table > GROUP BY scanid

Re: [SQL] View consistency

2001-11-01 Thread Tom Lane
"David M. Richter" <[EMAIL PROTECTED]> writes: > How does postgres keep the views consistent to the according tables( if > the original table has been changed)? It doesn't have to; views are not materialized in Postgres. A view is just a rewrite rule, or macro. regards,

Re: [SQL] transposing data for a view

2001-11-01 Thread Arian Prins
H Jeremy Bockholt schreef: > I have a generalized table: > > scanid | region | volume > - > 1 A 34.4 > 1 B 32.1 > 1 C 29.1 > 2 A 32.4 > 2 B 33.2 > 2 C 35.6 > . > . > . > > I want to creat

Re: [SQL] transposing data for a view

2001-11-01 Thread H Jeremy Bockholt
Hi, I see how your idea could work--the only thing I would change would be region needs to be scanid on the first line; however, I'm using PostgreSQL v7.03, so I can not do subqueries within FROM clause. Other than creating a temporary table, is there a way to restructure this solution to get aro

Re: [SQL] Recursive select

2001-11-01 Thread --CELKO--
The usual example of a tree structure in SQL books is called an adjacency list model and it looks like this: CREATE TABLE Personnel (emp CHAR(10) NOT NULL PRIMARY KEY, boss CHAR(10) DEFAULT NULL REFERENCES Personnel(emp), salary DECIMAL(6,2) NOT NULL DEFAULT 100.00); Personnel emp

[SQL] problem in group by

2001-11-01 Thread Md Aminur Rashid
  I have a table masterauthor which has columns as AUTHOR NAME and  ID ( ID is primary key ) and a second  TABLE*(sellTable )  having the numbers books of the author which are sold i mean the say that the all those authors whose books are being sold are entered in the second table I have

[SQL] View consistency

2001-11-01 Thread David M. Richter
Hello! Im using several views for the Usermanagment of a database. My question is: How does postgres keep the views consistent to the according tables( if the original table has been changed)? Is there a Rule? and how is the Rule invoked. With ON DELETE UPDATE INSERT of the original table? I d

Re: [SQL] How to use BYTEA type?

2001-11-01 Thread Radu-Adrian Popescu
Doing template1=> SELECT proname from pg_proc ; proname boolin boolout byteain byteaout you can see there is a byteaout function also. However, these are undocumented in the interactive docs, which is a shame indeed. I only learned of byteain/out af

[SQL] How to use BYTEA type?

2001-11-01 Thread Christopher Sawtell
Greetings folks, Please could a kind soul tell be how to extract data from a BYTEA type of field into a file, or better still tell me where I can find some doco? This is the table:- create table fax_info ( id serial, comment text, image bytea) ; This appears to work ( no erorr messages ):-