Re: [SQL] plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND variable?)

2004-10-25 Thread Tom Lane
Marinos Yannikos <[EMAIL PROTECTED]> writes: > create function blup_unique2 (text,text) returns boolean as 'begin > perform (select 1 from blup where t1=$1 or t1=$2 or t2=$1 or t2=$2 or > $1=$2 limit 1); return NOT FOUND; end' LANGUAGE plpgsql; You've got a syntax problem. PERFORM is syntactica

Re: [SQL] plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND

2004-10-25 Thread Edmund Bacon
Marinos Yannikos wrote: (btw.: I'm trying a few ways to ensure that all values in both t1 and t2 are unique: alter table blup add constraint check (blup_unique3(t1,t2)); - perhaps there are more elegant ways, any suggestions?) No doubt someone will tell me this is Very Wrong: create table blup_t

[SQL] plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND variable?)

2004-10-25 Thread Marinos Yannikos
Hi, I'm probably misintepreting the documented equivalence of PERFORM and SELECT INTO as far as the special variable FOUND is concerned, but the following 2 definitions do not seem to produce the same result. create table blup ( t1 text, t2 text ); create function blup_unique2 (text,text) return

Re: [SQL] "copy from" in "create function"

2004-10-25 Thread Jan Wieck
On 10/20/2004 6:03 PM, Gifford Hesketh wrote: Am I forgetting some limitation ? I get "ERROR: syntax error at or near "$1" at character 22" with this: CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS ' COPY b_import FROM $1 ; ' LANGUAGE 'sql' STABLE; Utility statements don't accept par

Re: [SQL] now() + integer, not rounded to whole day

2004-10-25 Thread Bruno Wolff III
On Mon, Oct 25, 2004 at 02:27:01 -0700, JN <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (JN) wrote in message news:<[EMAIL PROTECTED]>... > > Is it possible to add some portion of the day to now() ? I cannot > > round now() to whole days like now()::date. Hours, minutes and seconds > > are also

[SQL] Log

2004-10-25 Thread Davide Negri
Hello, i have installed the 8.0 beta3-dev1 version of postgres on my pc, and I want to disable log. How can I do? It is possible to disable and don’t write all the log, or how can I write all the log in a specific directory??   Thanks   Negri Davide --- Outgoing mail is certif

Re: [SQL] Aggregate Function with Argument

2004-10-25 Thread David Siegal
Mark, Works beautifully. Thanks for the clear explanation and code! -David On Tue, 19 Oct 2004, Mark Gibson wrote: > David Siegal wrote: > > I would like to create an aggregate function that returns a concatenation > > of grouped values. It would be particularly useful if I could pass an > > op

[SQL] "copy from" in "create function"

2004-10-25 Thread Gifford Hesketh
Am I forgetting some limitation ? I get "ERROR: syntax error at or near "$1" at character 22" with this: CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS ' COPY b_import FROM $1 ; ' LANGUAGE 'sql' STABLE; ---(end of broadcast)--- TIP 4:

[SQL] Question on the 8.0Beta Version

2004-10-25 Thread Davide Negri
Hello, i have installed postgres 8.0 beta3 as a program on my pc on windows xp. I have read on the installation note file that postgres server will not run with administrative permissions. I have read on your forum that this happened because i have installed the beta version: is it true t

Re: [SQL] [GENERAL] Log

2004-10-25 Thread Scott Marlowe
On Fri, 2004-10-22 at 07:52, Davide Negri wrote: > Hello, > > i have installed the 8.0 beta3-dev1 version of postgres on my pc, and > I want to disable log. How can I do? It is possible to disable and > donât write all the log, or how can I write all the log in a specific > directory?? If you us

[SQL] now() + integer, not rounded to whole day

2004-10-25 Thread JN
Is it possible to add some portion of the day to now() ? I cannot round now() to whole days like now()::date. Hours, minutes and seconds are also important to me. This I had in Oracle, and need to convert it : sysdate + 1/1440 Thanks for any suggestion. ---(end of broadca

Re: [SQL] Finding duplicated values

2004-10-25 Thread Bricklen
Kent Anderson wrote: I have a few tables that have duplicated values from an import from a different database. I have two keys I tried to set as primary and got an error ERROR: could not create unique index DETAIL: Table contains duplicated values. Is there some join I can use to compare the

Re: [SQL] now() + integer, not rounded to whole day

2004-10-25 Thread JN
[EMAIL PROTECTED] (JN) wrote in message news:<[EMAIL PROTECTED]>... > Is it possible to add some portion of the day to now() ? I cannot > round now() to whole days like now()::date. Hours, minutes and seconds > are also important to me. This I had in Oracle, and need to convert it > : > > sysdate

Re: [SQL] sql

2004-10-25 Thread Mike Rylander
On Mon, 25 Oct 2004 05:44:06 -0600, Andrew J. Kopciuch <[EMAIL PROTECTED]> wrote: > On Monday 25 October 2004 05:20, Mike Rylander wrote: > > SELECT * FROM temp50 GROUP BY gc ORDER BY ora DESC; > > You can not have have expressions (columns etc.) in the SELECT list that are > either not in a GROUP

Re: [SQL] sql

2004-10-25 Thread Andrew J. Kopciuch
On Monday 25 October 2004 05:20, Mike Rylander wrote: > SELECT * FROM temp50 GROUP BY gc ORDER BY ora DESC; You can not have have expressions (columns etc.) in the SELECT list that are either not in a GROUP BY clause, or used in an aggregate function when you use GROUP BY in the statement. By s

Re: [SQL] sql

2004-10-25 Thread Mike Rylander
On Mon, 25 Oct 2004 10:13:37 +0200, cristivoinicaru <[EMAIL PROTECTED]> wrote: > I have a postgres table like this: > > CREATE TABLE "temp50" ( > "gc" character varying(36), > "co" character varying(7), > "data" date, > "ora" smallint > > ); > > It contains the following records: > > 500370

Re: [SQL] bibliographic schema

2004-10-25 Thread James Cloos
Try googling for: bibtex sql That should provide some pointers that may help produce an effective sql schema for storing bibliographic references. -JimC -- James H. Cloos, Jr. <[EMAIL PROTECTED]> ---(end of broadcast)---

Re: [SQL] sql

2004-10-25 Thread Andrei Bintintan
> 2)if two ore more record have the same value of the maxim value of the "ora" > to select oly one of them At this point you really have to decide which criteria you use for this deciding. I strongly suggest to use a uniqe ID for each row in the table(in your case it is important): CREATE TABLE

Re: [SQL] Cross tabulations

2004-10-25 Thread Muhyiddin A.M Hayat
Dear, Thanks, that query is work, so. So, i would like to calculate total work time select date, employee_id, (select check_time-check_time::date from test where employee_id = x.employee_id and check_time::date = date and state = 'In') as in, (select check_time-check_time::date f

[SQL] sql

2004-10-25 Thread cristivoinicaru
I have a postgres table like this: CREATE TABLE "temp50" ( "gc" character varying(36), "co" character varying(7), "data" date, "ora" smallint ); It contains the following records: 5003707G9G9419 22012BB 10-14-2004 82 5003707G9G9419 22012BC 10-14-2004 44 5003707G9G9419 22022BB 10-14-2004 82