Re: [SQL] insert values

2001-02-23 Thread Ines . Klimann
On Thu, Feb 22, 2001 at 11:01:11PM -0500, Tom Lane wrote: > [EMAIL PROTECTED] writes: > > I have the following type : > > ... > > How can I insert a value in this table ? > > INSERT INTO entiers VALUES('1234') should work fine. > I have tried and I have this message : ex1=# insert into entiers

[HACKERS] ask for help !!! (emergency case)

2001-02-23 Thread Jaruwan Laongmal
dear all I hava 2 problems about view 1. i can't insert into view 2. i can't create view with union I try to insert into view as following create table t1 (id int,name varchar(12) check(id<=10)); create table t2 (id int,name varchar(12) check(id>10)); create view v1 as select * from t1,t2; insert

[ADMIN]

2001-02-23 Thread Jaume Teixi
Hi, I cannot use any kind of odbc because my customers have his local m$ access db's locally then export them on .txt with tab or | separated, then put on my server trought ftp. and is working ok except that the customers are on spanish databases then a data like: --DATE-NAME-LANG

AW: [HACKERS] ask for help !!! (emergency case)

2001-02-23 Thread Zeugswetter Andreas SB
> I hava 2 problems about view > 1. i can't insert into view > I try to insert into view as following > create table t1 (id int,name varchar(12) check(id<=10)); > create table t2 (id int,name varchar(12) check(id>10)); > create view v1 as select * from t1,t2; This is not an updateable view in a

Re: [SQL] Speed of SQL statements

2001-02-23 Thread Mathijs Brands
On Sun, Feb 18, 2001 at 03:42:43PM -0500, Kevin Quinlan allegedly wrote: > Does anyone have any performance numbers regarding SQL statements, > specifically SELECT, UPDATE, DELETE, and INSERT? For instance, on average > how long does a typical SELECT (UPDATE, DELETE, INSERT) statement take to > e

Re: [SQL] Speed of SQL statements

2001-02-23 Thread Mathijs Brands
On Sun, Feb 18, 2001 at 03:42:43PM -0500, Kevin Quinlan allegedly wrote: > Does anyone have any performance numbers regarding SQL statements, > specifically SELECT, UPDATE, DELETE, and INSERT? For instance, on average > how long does a typical SELECT (UPDATE, DELETE, INSERT) statement take to > e

Re: [SQL] insert values

2001-02-23 Thread Tom Lane
[EMAIL PROTECTED] writes: > ERROR: Load of file /ens/klimann/PostgreSQL/entier.o failed: Exec format error .o? Did you convert this file into a shared library? I'd expect .so or .sl depending on platform... regards, tom lane

[SQL] sum(bool)?

2001-02-23 Thread Olaf Zanger
hi there i'd like to add up the "true" values of a comparison like sum(a>b) it just doesn't work like this any workaround postgres 7.0 on linux thanks olaf -- soli-con Engineering Zanger Dipl.-Ing. (FH) Olaf Marc Zanger Lorrainestrasse 23 3013 Bern / Switzerland Fon: +41-31-332 9782 Mob: +

Re: [SQL] Can a function return a record set?

2001-02-23 Thread Josh Berkus
Mr. Taves, > Am I correct in concluding that I can't return a record > set from a function? > > For example, in MS SQL I would do: > > create procedure foo as > select * from yada > > I expected to be able to do the following in postgresql. > > create function foo (integer) returns (integer)

[SQL] sum(bool)?

2001-02-23 Thread Daniel Wickstrom
> "Olaf" == Olaf Zanger <[EMAIL PROTECTED]> writes: Olaf> hi there i'd like to add up the "true" values of a Olaf> comparison like Olaf> sum(a>b) Olaf> it just doesn't work like this Olaf> any workaround Try using a case statement: select sum(case when a > b then 1 e

Re: [SQL] sum(bool)?

2001-02-23 Thread Tod McQuillin
On Fri, 23 Feb 2001, Olaf Zanger wrote: > i'd like to add up the "true" values of a comparison like > > sum(a>b) > > it just doesn't work like this Try sum(case when a>b then 1 else 0 end) -- Tod McQuillin

Re: [SQL] sum(bool)?

2001-02-23 Thread Peter Eisentraut
Olaf Zanger writes: > i'd like to add up the "true" values of a comparison like > > sum(a>b) sum(case when a>b then 1 else 0 end) of maybe even just select count(*) from table where a>b; -- Peter Eisentraut [EMAIL PROTECTED] http://yi.org/peter-e/

Re: [SQL] sum(bool)?

2001-02-23 Thread Olaf Zanger
hi there, s cool, this works streight away and took 5 min. waiting for a answer :-) thanks very much to you tod personal and the mailing list for existence. Olaf Tod McQuillin schrieb: > > On Fri, 23 Feb 2001, Olaf Zanger wrote: > > > i'd like to add up the "true" values of a comparison

Re: [SQL] sum(bool)?

2001-02-23 Thread Andrew Perrin
Or how about just: SELECT count(*) FROM tablename WHERE a > b; -- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin [EMAIL PROTECTE

Re: AW: [HACKERS] ask for help !!! (emergency case)

2001-02-23 Thread Tom Lane
Zeugswetter Andreas SB <[EMAIL PROTECTED]> writes: > You probably wanted: > create view v1 as > select * from t1 > union all > select * from t2; Probably, but we don't support UNION in views before 7.1 :-( I'm not real clear on why t1 and t2 are separate tables at all in this example. Seems l

[SQL] How can i escape a '+' or a '+' in a regexp ?

2001-02-23 Thread Gabriel Fernandez
Hi fellows, I'm trying to the following query: select * from areas where titulo ~ '+' or titulo ~ '*' and the answer is: ERROR: regcomp failed with error repetition-operator operand invalid I have tried to escape the '+' and the '*' with a backslash, as follows: select * from areas where

Re: [SQL] How can i escape a '+' or a '+' in a regexp ?

2001-02-23 Thread Stephan Szabo
I believe you'll need two \ characters to escape the + or *. titulo ~ '\\+' On Fri, 23 Feb 2001, Gabriel Fernandez wrote: > Hi fellows, > > I'm trying to the following query: > > select * from areas where titulo ~ '+' or titulo ~ '*' > > and the answer is: > > ERROR: regcomp failed with e

[SQL] Need your help

2001-02-23 Thread Jyotsna Kypa
Hi, I need your help on something. I have to write a trigger (in sybase) that does this: Everytime a record gets updated it should update a column in that record with the current date/time. I am able to do it for the whole table, but how do I make sure the update happens only for that record which

Re: [SQL] How can i escape a '+' or a '+' in a regexp ?

2001-02-23 Thread Jie Liang
select field from table where field like '%\\%%' or field like '%*%'; select field from table where field ~ '.*\\*.*' or ~ '.*%.*'; Jie LIANG St. Bernard Software Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.stber

Re: [SQL] How can i escape a '+' or a '+' in a regexp ?

2001-02-23 Thread [EMAIL PROTECTED]
Gabriel, Two backslashes. > select * from areas where titulo ~ '\\+' or titulo ~ '\\*' Troy > > Hi fellows, > > I'm trying to the following query: > > select * from areas where titulo ~ '+' or titulo ~ '*' > > and the answer is: > > ERROR: regcomp failed with error repetition-operato

[SQL] Controlling Reuslts with Limit

2001-02-23 Thread Najm Hashmi
Hi, I was reading through Bruce's on line . I found follwing bit unclear... "Notice that each query uses ORDER BY . Although this clause is not required, LIMIT without ORDER BY returns random rows from the query, which would be useless. " When I run a query several time I get the same results

Re: [SQL] Need your help

2001-02-23 Thread Jie Liang
e.g. Try: CREATE TABLE emp ( id int4 primary key, empname text, salary int4, last_date datetime, last_user name); CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS BEGIN update emp set last_date=''now''::timestamp where id=NEW.id; RETURN NEW; END; ' LANGU

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Bruce Momjian
> Hi, > I was reading through Bruce's on line . I found follwing bit unclear... > > "Notice that each query uses ORDER BY . Although this clause is not required, > LIMIT without ORDER BY returns random rows from the query, which would be > useless. " It means there is no guarantee which rows wi

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Bryan White
> Hi, > I was reading through Bruce's on line . I found follwing bit unclear... > > "Notice that each query uses ORDER BY . Although this clause is not required, > LIMIT without ORDER BY returns random rows from the query, which would be > useless. " > > When I run a query several time I get t

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Jie Liang
My understanding: because you return a subset instead of a single value, so between 2 select ... limit ... queries. if you delete a record(say song_id=947) then insert it again. then results are different. So for a multiple users db, you should use oder by when you use limit. Jie LIANG St. Bern

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Bruce Momjian
> I don't think it is actually random. It just that the order is not defined > and other events may change the order. I believe that without an ORDER BY > or other clauses that cause an index to be used that the database tends to > return rows in the order stored on disk. This order tends to be

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Tom Lane
Najm Hashmi <[EMAIL PROTECTED]> writes: > I just want to know what exatly --"LIMIT without ORDER BY returns random rows > from the query" --means It means the results aren't guaranteed. It doesn't mean that the exact same query run under the exact same conditions by the exact same version of Po

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Stephan Szabo
It returns the first five rows it finds. Running the same query over again if there are no updates is safe, but if the table is updated there is the possibility it would find a different five rows. If the query would do a seq scan and you updated a row, the rows would be in a different order in

[SQL] Recursive Query (need of PL/pgSQL?)

2001-02-23 Thread Stephan Richter
Hello everyone, I have a system (simplified for this example) with the following two tables: TABLE1 id::int8 containerId::int8 containerType::varchar(100) moreInfo::text TABLE2 id::int8 containerId::int8 containerType::varchar(100) otherInfo::text

[SQL] syntax prob

2001-02-23 Thread postgresql
I am away from my server for the weekend and I need a little help. when doing updates of multiple fields there commas between the elements? I mean update table set cname = 'Bill', caddress = '2nd floor' where acode = 'AVAN'; I refer to the space between 'Bill' and caddress. if I could g

[SQL] logging a script

2001-02-23 Thread Ken Kline
Hello, I would like my psql script to log everything that it does. I set the following \set ECHO all \o foo.txt \qecho some sql, some ddl, etc... \o But foo.txt only contains DROP DROP DROP CREATE CREATE CREATE I want it to contain everything that I see on the screen, what am I missing?

[SQL] bug.. ?

2001-02-23 Thread Jeff MacDonald
A person recent pointed this out to me.. seems a bit funny, because limit 1 pretty much say's it't not gonna return multiple values. jeff > This doesn't work: > > CREATE FUNCTION vuln_port(int4) RETURNS int4 AS 'SELECT port FROM > i_host_vuln WHERE vuln = $1 GROUP BY port ORDER BY count(port)

[SQL] creating tables with different character set?

2001-02-23 Thread hubert depesz lubaczewski
hi, i have a problem. i'm living in poland, which has its national characters. of course they work great under postgresql, but: when i use non-C locale all ~ '^xxx' and like 'xxx%' searches are not using index scan. this is paintful. for some of the tables i dont need all national characters. in f

[SQL] HELP: m$ access -> psql howto ?

2001-02-23 Thread Jaume Teixi
Hi, I cannot use any kind of odbc because my customers have his local m$ access db's locally then export them on .txt with tab or | separated, then put on my server trought ftp. and is working ok except that the customers are on spanish databases then a data like: --DATE-NAME-LANG

[SQL] greetings

2001-02-23 Thread Ken Kline
I have just joined the list a few days ago and am trying quite hard to come up to speed with pgsql but i find documentaion frustratiing. I think maybe it;s just a matter of finding things that are of the correct scope. I've been an Oracle developer for over 6 years so often I know what it is I wa

Re: [SQL] bug.. ?

2001-02-23 Thread Tom Lane
Jeff MacDonald <[EMAIL PROTECTED]> writes: > A person recent pointed this out to me.. > seems a bit funny, because limit 1 pretty much > say's it't not gonna return multiple values. >> CREATE FUNCTION vuln_port(int4) RETURNS int4 AS 'SELECT port FROM >> i_host_vuln WHERE vuln = $1 GROUP BY port O

Re: [SQL] CREATE TABLE AS and ORDER BY

2001-02-23 Thread CM
"Joy Chuang" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I tried to use CREATE TABLE AS and ORDER BY. The query is as followed: > > create table freshhr21 as > select e.studentid, u.hoursxfer > from enrollmentstatus e, undergradclass u > where e.st

[SQL] Re: logging a psql script

2001-02-23 Thread Jeff Duffy
On Wed, 21 Feb 2001, Ken Kline wrote: > Hello, >I would like my psql script to log everything that it does. > I set the following > > \set ECHO all > \o foo.txt > \qecho > > some sql, some ddl, etc... > > \o > > > But foo.txt only contains > > DROP > DROP > DROP > CREATE > CREATE > CREA

Re: [SQL] greetings

2001-02-23 Thread Ian Lance Taylor
Ken Kline <[EMAIL PROTECTED]> writes: > I have just joined the list a few days ago and am trying quite hard > to come up to speed with pgsql but i find documentaion frustratiing. > I think maybe it;s just a matter of finding things that are of the > correct > scope. I've been an Oracle developer

Re: [SQL] greetings

2001-02-23 Thread Tom Lane
Ian Lance Taylor <[EMAIL PROTECTED]> writes: > PL/pgSQL does not support cursors. It also does not support goto. The context is pretty unclear here, but perhaps he needs ecpg not plpgsql ... is this to be client- or server-side code? regards, tom lane