[SQL] Re: PL/PGSQL function with parameters

2001-02-06 Thread Kovacs Zoltan
Unfortunately you cannot use parameters as you like. The FROM clause cannot contain a parameter. It must be constant. Zoltan -- Kov\'acs, Zolt\'an [EMAIL PROTECTED] http://www.math.u-szeged.hu/~kovzol

Re: [SQL] Problem with Day of Week

2001-02-06 Thread keith
Ok, so there is actually two standards then. Is this documented anywhere? Is this is something that is going to change? I don't want to write and app and have things "break" during and upgrade :) Thanks for the response. On Mon, 5 Feb 2001, Karel Zak wrote: > > On Mon, 29 Jan 2001, Keith Pe

[SQL] 1024 limit???

2001-02-06 Thread Mathieu Dube
Hi, Im building a server that uses libpq to connect to a database and authenticate the users that connect. I do PQfinish for the conn and PQclear for the result so there cant be a memory leak there. If I remove the function where I authenticate my server can handle as much clients as I want. I

[SQL] Transactions in PLPGSQL?

2001-02-06 Thread Ken Corey
Hi All! Are the BEGIN/END; seen in a typical PL/PGSQL function a transaction wrapper, or do I need to add another BEGIN/END block? Should I just put a 'rollback' in the function, or do I need to do something special? Thanks! -Ken

[SQL] parse error in create index

2001-02-06 Thread Hubert Palme
Hi, could someone, please, explain me the following parse error? adressen=> \d geburtstage Table= geburtstage +--+--+---+ | Field | Type| Length| +-

[SQL] "Subclassing" in SQL

2001-02-06 Thread Andrew Perrin
I hope that title line is reasonably accurate. Here's what I'm trying to do, and would love it anyone can provide guidance. I have a table of utterances in a focus group setting; each record contains an identifier for the speaker and group, as well as the length of the utterance (in words) and th

Re: [SQL] RE: C function for use from PLpgSQL trigger

2001-02-06 Thread Joe Conway
> You could send the column name directly into your c function. For example: > c_function_name(NEW.col1, NEW.col2, NEW.col3). Otherwise I am not sure how > to send NEW into a C function. You could try declaring NEW in your C > function as a tuple. Thanks for your reply. I was hoping that I cou

[SQL] Packages to Install

2001-02-06 Thread
What packages do I need for PostgreSQL 7.xx? I went to rpmfind.net and there were too many files. I am running a Pentium. Can someone please tell me what packages I need to install POstgreSQL 7.xx. P.S I am going to have a fresh install Thanks

[SQL] CREATE TABLE AS and ORDER BY

2001-02-06 Thread Joy Chuang
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.studentid = u.studentid and e.classtd = '1' order by u.hoursxfer But, it returns error message "ERROR: parser:

[SQL] Search

2001-02-06 Thread Sebastian --[ www.flashhilfe.de ]--
Hi I hope someone can help me My problem: I have make a search machine whit: LIKE '%$suchbegriffe[$i]%' but when I search Test - the search machine shows only entries whit Test. But not test or tESt. (sorry for my bad english) Regards, Sebastian

Re: [SQL] Problem with Day of Week

2001-02-06 Thread keith
Always- I think I'll use the to_char since I think you all are saying that that is ISO or at least POSIX. On Mon, 5 Feb 2001, Karel Zak wrote: > > On Mon, 5 Feb 2001 [EMAIL PROTECTED] wrote: > > > Ok, so there is actually two standards then. Is this documented > > anywhere? Is this is someth

RE: [SQL] PL/PGSQL function with parameters

2001-02-06 Thread Michael Ansley
Title: RE: [SQL] PL/PGSQL function with parameters Just for the record: DROP FUNCTION table_count(varchar); CREATE FUNCTION table_count(varchar) RETURNS integer AS ' DECLARE     SQL varchar;     RES integer; BEGIN     SQL = ''SELECT * INTO temp1 FROM '' || $1;     EXECUTE SQL

Re: [SQL] Search

2001-02-06 Thread Brett W. McCoy
On Mon, 5 Feb 2001, Sebastian --[ www.flashhilfe.de ]-- wrote: > I have make a search machine whit: > > LIKE '%$suchbegriffe[$i]%' > > but when I search Test - the search machine shows only entries > whit Test. But not test or tESt. LIKE is case-sensitive. You should convert your column to uppe

[SQL] SQL question

2001-02-06 Thread Alain Lavigne
I'm trying to extract references (relationships) between tables for the purpose of reverse/forward engineer from a modeling tool called PowerDesigner. Here is the sql: select u.usename, p.relname, v.usename, c.relname, t.tgconstrname, dumpref(t.tgargs, 4), **

[SQL] Re: Search

2001-02-06 Thread PM
force lower case or use the non case-senstitive search e.g. lower(column) LIKE lower('%$suchbegriffe[$i]%') or column ~* '$suchbegriffe[$i]' (no need for wildcards when using ~* it assumes %value%) "Sebastian --[ www.flashhilfe.de ]--" <[EMAIL PROTECTED]> wrote in message 95n58g$5fa$[EMAIL P

[SQL] Re: Search

2001-02-06 Thread Sebastian
Thank you!!! It works perfect !! Regards, Sebastian PM <[EMAIL PROTECTED]> schrieb in im Newsbeitrag: 95otrr$hjg$[EMAIL PROTECTED] > force lower case or use the non case-senstitive search e.g. > > lower(column) LIKE lower('%$suchbegriffe[$i]%') > > or > > column ~* '$suchbegriffe[$i]' > (no ne

Re: [SQL] CREATE TABLE AS and ORDER BY

2001-02-06 Thread Tom Lane
Joy Chuang <[EMAIL PROTECTED]> writes: > But, it returns error message "ERROR: parser: parse error at or near > "order"". Does "create table as" support "order by" inside of it? Evidently not. > I am using PostgreSQL 6.5.3. It seems to work in 7.0 and later. regards,

Re: [SQL] parse error in create index

2001-02-06 Thread Stephan Szabo
Functional indexes cannot currently take constant values to the function, so it's complaining about the constant 'month'. The current workaround is probably to create a function that does the date_part('month', ) for you and then use that function in the index creation. On Sat, 3 Feb 2001, Hube

Re: [SQL] PL/PGSQL function with parameters

2001-02-06 Thread Tom Lane
Michael Ansley <[EMAIL PROTECTED]> writes: > CREATE FUNCTION table_count(varchar) RETURNS integer AS ' > DECLARE > SQL varchar; > RES integer; > BEGIN > SQL = ''SELECT * INTO temp1 FROM '' || $1; > EXECUTE SQL; > SELECT count(*) INTO RES FROM temp1; > RETURN(RES

RE: [SQL] PL/PGSQL function with parameters

2001-02-06 Thread Michael Ansley
Title: RE: [SQL] PL/PGSQL function with parameters Yes, that was why I wrote it in the way that I did.  The table is effectively given a constant name, and the count is got from the table with a known name.  But of a kludge, but in 45sec, that was all I could come up with ;-) It would be VER

Re: [SQL] PL/PGSQL function with parameters

2001-02-06 Thread Josh Berkus
Tom, Jan, Michael, > While I have not looked closely, I seem to recall that plpgsql handles > INTO by stripping that clause out of the statement before it's passed to > the SQL engine. Evidently that's not happening in the EXECUTE case. > > Jan, do you agree this is a bug? Is it reasonable to

Re: [SQL] CREATE TABLE AS and ORDER BY

2001-02-06 Thread Jie Liang
Hey, Try: select e.studentid, u.hoursxfer into freshhr21 from enrollmentstatus e, undergradclass u where e.studentid = u.studentid and e.classtd = '1' order by u.hoursxfer Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL

Re: [SQL] Search

2001-02-06 Thread Jie Liang
Hi, You seem want to match string insensitively, I guess. Try: ~* 'test' -- match Test|tEst|tESt ... ~* '.*test.*' -- match whateverTesTwhatever Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 [EMAIL PROTECTED] www.ipinc.com O

[SQL] type casting: varchar to date

2001-02-06 Thread J.Fernando Moyano
Is there some way to do something like this ?? : crate table t ( a varchar(12), b date ); select (a::date-b) from t; ERROR: cannot cast type 'varchar' to 'date'. Thanks -- Fer

[SQL] timestamp- milliseconds since epoch output

2001-02-06 Thread jkakar
Hi, I'm using a timestamp field called date_created. Whenever I select it I get: select date_created from tbl_user; date_created 2001-02-05 17:23:26-08 2001-02-05 17:45:39-08 2001-02-03 03:58:53-08 (3 rows) I've tried using variations of to_char and to_t

Re: [SQL] type casting: varchar to date

2001-02-06 Thread Karel Zak
On Tue, 6 Feb 2001, J.Fernando Moyano wrote: > > Is there some way to do something like this ?? : Yes, select to_timestamp('hello 02-06-2001', '"hello "MM-DD-'); Karel

Re: [SQL] timestamp- milliseconds since epoch output

2001-02-06 Thread Karel Zak
On Tue, 6 Feb 2001 [EMAIL PROTECTED] wrote: > Hi, > > I'm using a timestamp field called date_created. Whenever I select it > I get: > > select date_created from tbl_user; > date_created > > 2001-02-05 17:23:26-08 > 2001-02-05 17:45:39-08 > 2001-02-03 0

Re: [SQL] timestamp- milliseconds since epoch output

2001-02-06 Thread Tom Lane
[EMAIL PROTECTED] writes: > I've tried using variations of to_char and to_timestamp but can't seem > to get the timestamp as a value of milliseconds since the Epoch (Jan > 1, 1970). regression=# select date_part('epoch','2001-02-05 17:23:26.123456-08'::timestamp); date_part --

Re: [SQL] Postgres-HOWTO

2001-02-06 Thread Christopher Sawtell
On Tue, 06 Feb 2001 08:50, Poet/Joshua Drake wrote: > Has been removed from the LDP website. Good news indeed! Now what are we going to do with it? Can the original document's source be made available so that somebody can do the needed work without having to re-key. There is a _lot_ of very g

Re: [SQL] Postgres-HOWTO

2001-02-06 Thread Poet/Joshua Drake
Hello, The Postgres team from PGSQL, Inc. has agreed to provide us with a new version. J On Wed, 7 Feb 2001, Christopher Sawtell wrote: >On Tue, 06 Feb 2001 08:50, Poet/Joshua Drake wrote: >> Has been removed from the LDP website. > >Good news indeed! > >Now what are we going to do with it? >

[SQL] how to do plpgsql?

2001-02-06 Thread Joseph Shraibman
When trying to do some of the examples on http://www.postgresql.org/docs/postgres/c40914344.htm I keep getting: ERROR: Unrecognized language specified in a CREATE FUNCTION: 'plpgsql'. Recognized languages are sql, C, internal and the created procedural languages. version is: PostgreSQL 7.0.3

Re: [SQL] how to do plpgsql?

2001-02-06 Thread Josh Berkus
Joseph, First you need to install plpgsql on a per database basis, or you can just install it on template1 and it will get added to all new databases. CREATE FUNCTION "plpgsql_call_handler" ( ) RETURNS opaque AS '/usr/lib/pgsql/plpgsql.so' LANGUAGE 'C'; CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgs

Re: [SQL] how to do plpgsql?

2001-02-06 Thread Joseph Shraibman
Huh. You'd think this would be prominent in the documentation page at http://www.postgresql.org/docs/postgres/c4091.htm Thanks. Josh Berkus wrote: > > Joseph, > > First you need to install plpgsql on a per database > basis, or you can just install it on template1 and it > will get added to al

[SQL] plpgsql error: cache lookup from pg_proc failed

2001-02-06 Thread Joseph Shraibman
playpen=# create table aa( playpen(# a int, playpen(# b int, playpen(# t timestamp playpen(# ); CREATE playpen=# playpen=# playpen=# CREATE FUNCTION touch () RETURNS OPAQUE AS ' playpen'# BEGIN playpen'# new.t := current_timestamp; playpen'# RETURN new; playpen'# END; pl

Re: [SQL] Re: SQL Join - MySQL/PostgreSQL difference?

2001-02-06 Thread Brice Ruth
Ross, Thanx for the heads up on this. The select did indeed return something other than four: 5. I updated as you suggested, but that alone didn't fix the problem. I'm updating tblFDBMono now with the same type of 'fix' to see if this is the root of the problem. Is '=' handled differently bet

Re: [SQL] Re: SQL Join - MySQL/PostgreSQL difference?

2001-02-06 Thread Brice Ruth
Unfortunately ... that didn't seem to help :( I used btrim on all the fields that were part of an equals (=) statement and reran the select and got the same result (0 rows). After I was in the process of updating the tables, I thought that this may fail ... since again, the 'manual join' of thes

[SQL] RE: plpgsql error: cache lookup from pg_proc failed

2001-02-06 Thread Michael Davis
Setting NEW in an AFTER update or insert trigger is not wise. Try using a before update trigger instead. -Original Message- From: Joseph Shraibman [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, February 06, 2001 6:35 PM To: [EMAIL PROTECTED] Subject:plpgsql error: cache looku

Re: [SQL] RE: plpgsql error: cache lookup from pg_proc failed

2001-02-06 Thread Joseph Shraibman
Michael Davis wrote: > > Setting NEW in an AFTER update or insert trigger is not wise. Try using a before >update trigger instead. > I still get the error message. > -Original Message- > From: Joseph Shraibman [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, February 06, 2001 6:35 PM >

Re: [SQL] how to do plpgsql?

2001-02-06 Thread Christopher Sawtell
On Wed, 07 Feb 2001 14:18, Joseph Shraibman wrote: > Huh. You'd think this would be prominent in the documentation page at > http://www.postgresql.org/docs/postgres/c4091.htm Thanks from me for that one too. What about incorporating that particular functionality into the initdb program. Strike

[SQL] Is this a bug, or is it just me?

2001-02-06 Thread Josh Berkus
Tom et al. Discovered this quirk in foriegn keys: In the preliminary version of a database, I added foriegn key constraints to a number of tables, linking them to a column in a shared reference table (status.status) that was only one-half of a composite primary key (and thus the values were not

Re: [SQL] PL/PGSQL function with parameters

2001-02-06 Thread Anatoly K. Lasareff
> "DR" == David Richter <[EMAIL PROTECTED]> writes: DR> Folks, DR> I wrote that function, wich doesn't work. I want to hand over the name DR> of the tables(relation_table, update_table) and a DR> column(column_to_fill). The intention is, to use the function also with DR> other tables(not

Re: [SQL] Transactions in PLPGSQL?

2001-02-06 Thread Anatoly K. Lasareff
> "KC" == Ken Corey <[EMAIL PROTECTED]> writes: KC> Hi All! KC> Are the BEGIN/END; seen in a typical PL/PGSQL function a transaction wrapper, KC> or do I need to add another BEGIN/END block? No, BEGIN & END in plpgsql function are not transaction control statemens, but elements of plpgsq