Found a solution:
-- my_constraint(0) = turn off constraint
-- my_constraint(1) = turn ON constraint
CREATE OR REPLACE FUNCTION my_constraint(INTEGER)
RETURNS VARCHAR
AS '
DECLARE
cmd VARCHAR;
BEGIN
IF $1 = 0
THEN
I'm running Postgres 7.3.2 in Redhat 9.0.
I'm trying to execute a function below defined as a stored procedure
ALTER TABLE tms_schedule DROP CONSTRAINT "$1";
However, postgres thinks the "$1" is a parameter value. How do I tell
postgres to treat it as a literal $1?
TIA,
Robert
> > I've a problem with escaping a \ in a string.
> >
> > When I enter the query:
> >
> > SELECT '''\\\''; I get the right result: '\'
> >
> > But when I try this in a Function:
> >
> > CREATE FUNCTION sp_tmp() RETURNS varchar(10)
> > AS '
> > SELECT ''\\\' AS RESULT'
> > LANGUAGE 'sql';
"Martijn van Dijk" <[EMAIL PROTECTED]> writes:
> But when I try this in a Function:
> CREATE FUNCTION sp_tmp() RETURNS varchar(10)
> AS '
> SELECT ''\\\' AS RESULT'
> LANGUAGE 'sql';
> I get the following Parse-erros:
You need an extra level of quoting because the function body is itsel
From: "Martijn van Dijk" <[EMAIL PROTECTED]>
> I've a problem with escaping a \ in a string.
>
> When I enter the query:
>
> SELECT '''\\\''; I get the right result: '\'
>
> But when I try this in a Function:
>
> CREATE FUNCTION sp_tmp() RETURNS varchar(10)
> AS '
> SELECT ''\\\' AS RESUL
Hello all,
I've a problem with escaping a \ in a string.
When I enter the query:
SELECT '''\\\''; I get the right result: '\'
But when I try this in a Function:
CREATE FUNCTION sp_tmp() RETURNS varchar(10)
AS '
SELECT ''\\\' AS RESULT'
LANGUAGE 'sql';
I get the following Parse-erros: