Re: [GENERAL] column name gets substitudes inside an execute statement of a trigger function. how to avoid it?!

2009-06-09 Thread Stephan Szabo
On Tue, 9 Jun 2009, G. Allegri wrote: > Hello list. > I'm a newbie with plpgsql, so I'm sorry for doing stupid questions... > I have a situation whit one table where items are related to two other > tables through a common id (unique in the first table) and the table > name. Whenever the user exec

Re: [GENERAL] column name gets substitudes inside an execute statement of a trigger function. how to avoid it?!

2009-06-09 Thread G. Allegri
Stephan, you're rigth. It was just a first try. In the real situation "seconda" and "terza" have a prima_id column. So the right one is: execute 'UPDATE '|| NEW.tabella ||' SET nome='|| quote_literal(NEW.nome) ||' WEHERE prima_id=' || NEW.id || ';'; I though that double apices would quote. That w

Re: [GENERAL] column name gets substitudes inside an execute statement of a trigger function. how to avoid it?!

2009-06-09 Thread G. Allegri
Great, quote_literal() solved it! It was so easy :) Thx Richard 2009/6/9 Richard Huxton : > G. Allegri wrote: >> >> ERROR: Column 'lets_try' does not exist >> LINE 1: INSERT INTO seconda (nome) VALUES ('lets_try') >> >> My function and trigger are: >> >> CREATE OR REPLACE FUNCTION fun1() RETURNS

Re: [GENERAL] column name gets substitudes inside an execute statement of a trigger function. how to avoid it?!

2009-06-09 Thread Richard Huxton
G. Allegri wrote: ERROR: Column 'lets_try' does not exist LINE 1: INSERT INTO seconda (nome) VALUES ('lets_try') My function and trigger are: CREATE OR REPLACE FUNCTION fun1() RETURNS TRIGGER AS $primaprova$ DECLARE nome varchar; BEGIN IF (TG_OP='INSERT') THEN execute 'INSERT INTO ' || NEW.tab

[GENERAL] column name gets substitudes inside an execute statement of a trigger function. how to avoid it?!

2009-06-09 Thread G. Allegri
Hello list. I'm a newbie with plpgsql, so I'm sorry for doing stupid questions... I have a situation whit one table where items are related to two other tables through a common id (unique in the first table) and the table name. Whenever the user execute an operation on an item of the first one ("pr

Re: [GENERAL] column name with plpgsql

2009-02-07 Thread Alain Roger
Thanks a lot Raymond it works well. On Sat, Feb 7, 2009 at 3:32 PM, Raymond O'Donnell wrote: > On 07/02/2009 14:26, Alain Roger wrote: > > > i have a table which can be altered with several additional column. How > can > > i test under plpgsql if a particular column already exists ? > > select 1

Re: [GENERAL] column name with plpgsql

2009-02-07 Thread Raymond O'Donnell
On 07/02/2009 14:26, Alain Roger wrote: > i have a table which can be altered with several additional column. How can > i test under plpgsql if a particular column already exists ? select 1 from information_schema.columns where table_name = 'your_table_name_here' and column_name = 'your_colum

Re: [GENERAL] column name with plpgsql

2009-02-07 Thread Grzegorz Jaśkiewicz
information_schema is the keyword here. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] column name with plpgsql

2009-02-07 Thread Alain Roger
Hi, i have a table which can be altered with several additional column. How can i test under plpgsql if a particular column already exists ? thx. -- Alain --- Windows XP x64 SP2 / Fedora 10 KDE 4.2 PostgreSQL 8.3.5 / MS SQL server 2005 Apac

Re: [GENERAL] column name order matters in insert into foo from bar

2008-12-04 Thread Grzegorz Jaśkiewicz
On Thu, Dec 4, 2008 at 1:27 PM, Pavel Stehule <[EMAIL PROTECTED]> wrote: > p.s. you can try use stored procedure for generating these statements yeah, I ended up generating it using: select array_to_string(ARRAY(select column_name::text FROM information_schema.columns where table_name='foo'), '

Re: [GENERAL] column name order matters in insert into foo from bar

2008-12-04 Thread Pavel Stehule
2008/12/4 Grzegorz Jaśkiewicz <[EMAIL PROTECTED]>: > to answer myself, and also make matter a bit more complicated. > the table has like 20 columns, so - yes, I can probably name all of > them one by one, but - is there any way to do it without need to name > all of them ? > no, regards Pavel Ste

Re: [GENERAL] column name order matters in insert into foo from bar

2008-12-04 Thread Grzegorz Jaśkiewicz
to answer myself, and also make matter a bit more complicated. the table has like 20 columns, so - yes, I can probably name all of them one by one, but - is there any way to do it without need to name all of them ? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make chan

[GENERAL] column name order matters in insert into foo from bar

2008-12-04 Thread Grzegorz Jaśkiewicz
hey, it looks , as if when I have two tables, say create table foo( a int, b varchar, c float ); and : create table bar( b varchar, a int, c float ); migration of data from one to the other using insert into foo select * from bar; will fail. How can I walk around that please ? --

Re: [GENERAL] Column name 'user' not allowed?

2004-07-09 Thread Thomas Mueller
> I tried to install phpopenchat but I can't create this table: > > poc=> CREATE TABLE poc_user_account ( > poc(> USER varchar(255) NOT NULL, Thanks everyone! Creating the database with quoted USER column worked fine, now I have to resolve the other problems. I'd like to see one application de

[GENERAL] Column name 'user' not allowed?

2004-07-07 Thread Thomas Mueller
Hi, I tried to install phpopenchat but I can't create this table: poc=> CREATE TABLE poc_user_account ( poc(> USER varchar(255) NOT NULL, poc(> PASSWORD varchar(255), poc(> CONFIRM_CODE char(32), poc(> DISABLED int NOT NULL DEFAULT '0', poc(> KICKED int NOT NULL DEFAULT '0', poc(> PAS

[GENERAL] Column name

2001-05-24 Thread Linh Luong
Hi, I am trying to do a 2 joins between 3 tables. ie) select , coalesce(TRR.ABC, SOC.ABC) as newABC, ... from A join (B join C on (..)) on (..)) as TRR left join (D join E on (..)) as SOC on (TRR.Field1=SOC.Field2) When I run this it says that there is an ambiguous field. Yes after

Re: [GENERAL] Column name case conversion

2000-09-08 Thread Stephan Szabo
Sorry I didn't respond sooner -- lost the thread. :( Yeah, I can see where you're seeing this now. Not so much in the queries as in the code that needs to access the results. Your suggestion would work (theoretically the server could do something similar in reverse (store a real name and low

[GENERAL] Column name case conversion

2000-09-05 Thread Zeljko Trogrlic
Hello, I'm getting strange length results for columns with UNICODE data. I entered following string into database: abcüäöèæž First three characters are ASCII, second three are German and third three are Croatian. When I execute: select name, length(name), character_length(name), octet_length(na

Re: [GENERAL] column name length

1998-08-20 Thread Aleksey Dashevsky
Neither 16, nor 32, but 31 ! This is also true for table name. Al. On Thu, 20 Aug 1998, Rostislav Matl wrote: > > I'm not sure if column name length limit is 16 or 32, > can somebody tell me ? > > +-+ > | ROSTISLAV M

[GENERAL] column name length

1998-08-20 Thread Rostislav Matl
I'm not sure if column name length limit is 16 or 32, can somebody tell me ? +-+ | ROSTISLAV MATL, student of Masaryk University - Faculty of Informatics | | e-mail: [EMAIL PROTECTED] WWW: http://www.fi.muni.c