[SQL] Like phrase

2003-09-03 Thread Michał Wróblewski (Muerte)
Hello,

I've got a question about "LIKE" phrase. I have such a phrase:
LIKE UPPER(Key_Zawod)
And I want to write after Key_Zawod % but it doesn't work. Is there any special way to 
code this phrase?   

-- 
greetings

Michał Wróblewski  #GG: 111769 #ICQ: 113904213
Administrator Sieci SSK Ligota: www.ligota.eu.org
e-mail: [EMAIL PROTECTED] [EMAIL PROTECTED]
www: http://www.ligota.eu.org/muerte


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [SQL] Like phrase

2003-09-03 Thread Tomasz Myrta
Hello,

I've got a question about "LIKE" phrase. I have such a phrase:
LIKE UPPER(Key_Zawod)
And I want to write after Key_Zawod % but it doesn't work. Is there any special way to code this phrase?   
like upper(key_zawod) || '%'

Regards,
Tomasz Myrta
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [SQL] [BUGS] session variable

2003-09-03 Thread Peter Eisentraut
sad writes:

> The first problem using temp table is:
>
> CREATE TABLE locals (name text, value text);
>
> CREATE OR REPLACE FUNCTION test_locals_access() RETURNS text AS '
> DECLARE i text;
> BEGIN
> SELECT value INTO i FROM locals WHERE name=''n1''
> RETURN i;
> END;
> ' LANGUAGE 'plpgsql';
>
> SELECT test_locals_access() ;
>
> column
> -
> 
>
> CREATE TEMP TABLE locals (name text, value text);
> INSERT INTO locals VALUES ('n1','xxx');
>
> SELECT test_locals_access() ;
>
> column
> -
><=== the Function seing global table

This is a problem in plpgsql, not in temporary tables.

> the second problem may be resolved with your advise.
> look:
>
> i want to log operations on the data in some tables.
> so i declared sufficient triggers which write to the log-table.
>
> and now i want to mark each log-record with the "operator_id"
> (e.g. to log who made an update)
>
> what possible ways are there ?
>
> if i use temp table to inform the triggers about "operator_id"
> then i have problems in manual updates of these tables
> (temp table in my session needed too)

Use session_user, or restrict permissions on the temporary table.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


[SQL] unsubscribe

2003-09-03 Thread Antony Gubert


_
Need a naukri? Your search ends here. http://www.msn.co.in/naukri/ 50,000 of 
the best jobs!

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [SQL] [BUGS] session variable

2003-09-03 Thread Bruce Momjian
Peter Eisentraut wrote:
> sad writes:
> 
> > The first problem using temp table is:
> >
> > CREATE TABLE locals (name text, value text);
> >
> > CREATE OR REPLACE FUNCTION test_locals_access() RETURNS text AS '
> > DECLARE i text;
> > BEGIN
> > SELECT value INTO i FROM locals WHERE name=''n1''
> > RETURN i;
> > END;
> > ' LANGUAGE 'plpgsql';
> >
> > SELECT test_locals_access() ;
> >
> > column
> > -
> > 
> >
> > CREATE TEMP TABLE locals (name text, value text);
> > INSERT INTO locals VALUES ('n1','xxx');
> >
> > SELECT test_locals_access() ;
> >
> > column
> > -
> ><=== the Function seing global table
> 
> This is a problem in plpgsql, not in temporary tables.

Yes, see the FAQ.  You have to use EXECUTE for temp table access in
functions.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings