BUG #1875: Function parameter names clash with table column names

Поиск
Список
Период
Сортировка
От Byron
Тема BUG #1875: Function parameter names clash with table column names
Дата
Msg-id 20050910164644.32CF0F0C65@svr2.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #1875: Function parameter names clash with table column names  (David Fetter <david@fetter.org>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      1875
Logged by:          Byron
Email address:      byron.hammond@westnet.com.au
PostgreSQL version: 8.0.3
Operating system:   Windows XP
Description:        Function parameter names clash with table column names
Details:

-----------------------------
Error Details from PgAdminIII
-----------------------------
ERROR:  syntax error at or near "$1" at character 28
QUERY:  INSERT INTO test_table_0 ( $1 ,  $2 ,  $3 ) VALUES ( $4 ,  $5 ,  $6
)
CONTEXT:  PL/pgSQL function "test_function_0" line 2 at SQL statement

------------
Problem Code
------------
CREATE TABLE test_table_0 (
    a    varchar(255),
    b    varchar(255),
    c    varchar(255)
);

CREATE OR REPLACE FUNCTION test_function_0(a varchar, b varchar, c varchar)
RETURNS INTEGER AS $$
BEGIN
    INSERT INTO test_table_0 (a, b, c) VALUES (a, b, c);
    RETURN 1;
END
$$ LANGUAGE 'plpgsql';

SELECT test_function_0('a', 'b', 'c');

DROP FUNCTION test_function_0(varchar, varchar, varchar);
DROP TABLE test_table_0;

-------------------
Additional Comments
-------------------
It appears in this case that the parameter names of the
function cannot be the same as the column names used
by the INSERT statement -- clashes.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Lee Benson"
Дата:
Сообщение: BUG #1873: "Invalid username specified" during install
Следующее
От: "Sijin MS"
Дата:
Сообщение: BUG #1870: Insertion problem