pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedUnable to use '-' in column names in PLPGSQL
3+ messages / 3 participants
[nested] [flat]
* Unable to use '-' in column names in PLPGSQL
@ 2001-11-15 13:38 Aasmund Midttun Godal <postgresql@envisity.com>
2001-11-15 13:57 ` Re: Unable to use '-' in column names in PLPGSQL Martín Marqués <martin@bugs.unl.edu.ar>
2001-11-15 16:06 ` Re: Unable to use '-' in column names in PLPGSQL Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 3+ messages in thread
From: Aasmund Midttun Godal @ 2001-11-15 13:38 UTC (permalink / raw)
To: pgsql-sql
CREATE FUNCTION is_parent(INTEGER, INTEGER) RETURNS BOOLEAN AS '
DECLARE
parent ALIAS FOR $1;
tull ALIAS for $2;
kid INTEGER;
BEGIN
kid := tull;
LOOP
SELECT INTO kid "dir-id" FROM dir WHERE id = kid;
IF kid = parent THEN
RETURN TRUE;
END IF;
IF kid IS NULL THEN
RETURN FALSE;
END IF;
END LOOP;
END;
' LANGUAGE 'plpgsql';
Will cause the following compilation error:
NOTICE: plpgsql: ERROR during compile of is_parent near line 8
ERROR: unterminated "
If I change the column name to dir_id it works fine.
It does not matter whether or not I use quotes.
Aasmund Midttun Godal
aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Unable to use '-' in column names in PLPGSQL
2001-11-15 13:38 Unable to use '-' in column names in PLPGSQL Aasmund Midttun Godal <postgresql@envisity.com>
@ 2001-11-15 13:57 ` Martín Marqués <martin@bugs.unl.edu.ar>
1 sibling, 0 replies; 3+ messages in thread
From: Martín Marqués @ 2001-11-15 13:57 UTC (permalink / raw)
To: pgsql-sql
On Jue 15 Nov 2001 10:38, you wrote:
> CREATE FUNCTION is_parent(INTEGER, INTEGER) RETURNS BOOLEAN AS '
> DECLARE
> parent ALIAS FOR $1;
> tull ALIAS for $2;
> kid INTEGER;
> BEGIN
> kid := tull;
> LOOP
> SELECT INTO kid "dir-id" FROM dir WHERE id = kid;
> IF kid = parent THEN
> RETURN TRUE;
> END IF;
> IF kid IS NULL THEN
> RETURN FALSE;
> END IF;
> END LOOP;
> END;
> ' LANGUAGE 'plpgsql';
You shoun't use '-' in column names. Use '_' instead.
Saludos... :-)
P.D.: Doesn't it give you an error when you try to create the table with does
column names?
--
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués | mmarques@unl.edu.ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Unable to use '-' in column names in PLPGSQL
2001-11-15 13:38 Unable to use '-' in column names in PLPGSQL Aasmund Midttun Godal <postgresql@envisity.com>
@ 2001-11-15 16:06 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2001-11-15 16:06 UTC (permalink / raw)
To: Aasmund Midttun Godal <postgresql@envisity.com>; +Cc: pgsql-sql
"Aasmund Midttun Godal" <postgresql@envisity.com> writes:
> SELECT INTO kid "dir-id" FROM dir WHERE id = kid;
plpgsql has a fairly brain-dead notion of what a double-quoted
identifier can be: in fact, it really has *no* notion of it, but expects
the same set of identifier characters that would be allowed in unquoted
identifiers.
I've had a TODO note to do something about that ... but not yet gotten
to it.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-11-15 16:06 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-11-15 13:38 Unable to use '-' in column names in PLPGSQL Aasmund Midttun Godal <postgresql@envisity.com>
2001-11-15 13:57 ` Martín Marqués <martin@bugs.unl.edu.ar>
2001-11-15 16:06 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox