Re: how to edit a function from psql? - Mailing list pgsql-general

From Karim Nassar
Subject Re: how to edit a function from psql?
Date
Msg-id 1099960133.27046.94.camel@denali.cse.nau.edu
Whole thread Raw
In response to Re: how to edit a function from psql?  (Thomas F.O'Connell <tfo@sitening.com>)
List pgsql-general
On Sun, 2004-11-07 at 20:36, Thomas F.O'Connell wrote:
> What version of postgres are you using? In postgresql-7.4.6, I get an
> empty query buffer when I try what you describe here.

7.4.5

I got it. Apparently the query buffer is the last run query (good or
bad). So, to get my function into the buffer, I would have to cut and
paste it (which I do often, and is what my last post showed). Backslash
functions are not included. I assume you ran no queries before \e, and
got an empty buffer.

Seems like \e is merely a convenient way to deal with long queries. I
always have my editor open, so this isn't much of a win for me.

Still, it might be nice to have a way to get the function into the
buffer without cutting and pasting from the (normally open) editor.

As a point of interest...

1)  orfs=# select * from person
2)  orfs-# ;
3)  ERROR:  relation "person" does not exist
4)  orfs=# \e
5)  orfs-# select
6)  orfs-# *
7)  orfs-# from
8)  orfs-# person
9)  orfs-# ;
10) ERROR:  syntax error at or near "select" at character 23
11) orfs=# \e
12) orfs=# select * from person;
13) ERROR:  relation "person" does not exist
14) orfs=# \e


At line 4, the query buffer has:
~~~~~~~~~~~~~~~~~~~~~
select * from person
~~~~~~~~~~~~~~~~~~~~~

Note that there is no semi-colon.

At line 11, the contents of the query buffer is:
~~~~~~~~~~~~~~~~~~~~~
select * from person

select
*
from
person
~~~~~~~~~~~~~~~~~~~~~~

And at line 14:
~~~~~~~~~~~~~~~~~~~~~~
select * from person;
~~~~~~~~~~~~~~~~~~~~~~


It seems that the query editor just dumps the contents to the command
line. Why the semi-colons from lines 2 and 9 aren't in the query buffers
is a mystery to me.

\<.



pgsql-general by date:

Previous
From: "John White"
Date:
Subject: The classic "NEW used in query that is not in a rule" problem again
Next
From: Karim Nassar
Date:
Subject: Re: subselect, order by and left join