GeSHi module for Postgresql?

Поиск
Список
Период
Сортировка
Искать

GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
GeSHi  is a system for 
highlighting code. I've just installed the WP-Syntax plugin, which utilizes 
GeSHi, in my WP blog because I like code highlighting and am tired of doing it 
more or less by hand. However, I was disappointed when I didn't find PostgreSQL 
on the list of supported languages.

I wonder if any of you have at least started writing a PostgreSQL module, in 
which case I'll be happy to contribute. From a peek at the plsql module, it 
doesn't look like rocket science. If I have to write one from scratch, I 
wonder if there' s a compiled list somewhere of just the PostgreSQL keywords 
and function names. That would be of great help.

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/

Re: GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
On Monday 3. May 2010 22.49.21 Leif Biberg Kristensen wrote:
> GeSHi  is a system for 

Sorry about that link. It's of course .

*blush*

-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/

Re: GeSHi module for Postgresql?

От:
Richard Broersma <richard.broersma@gmail.com>
Дата:
On Mon, May 3, 2010 at 1:49 PM, Leif Biberg Kristensen
 wrote:
> I
> wonder if there' s a compiled list somewhere of just the PostgreSQL keywords
> and function names. That would be of great help.

These are what I know of:

http://www.postgresql.org/docs/9.0/static/sql-keywords-appendix.html
http://www.postgresql.org/docs/9.0/static/functions.html

http://www.postgresql.org/docs/9.0/static/reference.html

-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

Re: GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
On Monday 3. May 2010 23.05.54 Richard Broersma wrote:
> On Mon, May 3, 2010 at 1:49 PM, Leif Biberg Kristensen
>  wrote:
> > I
> > wonder if there' s a compiled list somewhere of just the PostgreSQL 
keywords
> > and function names. That would be of great help.
> 
> These are what I know of:

Richard, thank you.
 
> http://www.postgresql.org/docs/9.0/static/sql-keywords-appendix.html

That list is a table with descriptions etc, but I can extraxt the keywords 
with a little Perl magic.

> http://www.postgresql.org/docs/9.0/static/functions.html

That's not very useful. I see that I can get a list of the functions in public 
with a \df, put can I get a corresponding one for the system functions?

> http://www.postgresql.org/docs/9.0/static/reference.html

That list is probably superfluous, as I suspect those words are already in the 
keywords list.

But thanks anyway. I've also received a private message from a guy with an 
«under work» project, and along with your hints it's a good start.

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/

Re: GeSHi module for Postgresql?

От:
Christophe Chauvet <christophe@kryskool.org>
Дата:
Le 03/05/10 22:54, Leif Biberg Kristensen a écrit :
> On Monday 3. May 2010 22.49.21 Leif Biberg Kristensen wrote:
>> GeSHi  is a system for 
> 
> Sorry about that link. It's of course .
> 
> *blush*
> 
hi

i have begin this work, you can find it at

http://svn.postgresqlfr.org/repos/tools/geshi/trunk/

Regards,

-- 
Christophe Chauvet
Président d'Ornix (http://ornix.org)
Membres et Administrateur de PostgreSQLFr (http://postgresql.fr)

Re: GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
On Monday 3. May 2010 23.02.05 Christophe Chauvet wrote:

> hi
> 
> i have begin this work, you can find it at
> 
> http://svn.postgresqlfr.org/repos/tools/geshi/trunk/

Christophe, thank you very much!

I've started to look at it, and have already taken your postgresql.php for a 
spin. You can see the first test at my blog under the title «Regular expression 
fun in PostgreSQL». I don't want to post the direct link here.

As soon as I've got some real progress, I'll send you an updated file.

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/

Re: GeSHi module for Postgresql?

От:
Alvaro Herrera <alvherre@commandprompt.com>
Дата:
Leif Biberg Kristensen wrote:
> On Monday 3. May 2010 23.05.54 Richard Broersma wrote:
> > On Mon, May 3, 2010 at 1:49 PM, Leif Biberg Kristensen
> >  wrote:
> > > I
> > > wonder if there' s a compiled list somewhere of just the PostgreSQL 
> keywords
> > > and function names. That would be of great help.
> > 
> > These are what I know of:
> 
> Richard, thank you.
>  
> > http://www.postgresql.org/docs/9.0/static/sql-keywords-appendix.html
> 
> That list is a table with descriptions etc, but I can extraxt the keywords 
> with a little Perl magic.

Why wouldn't you simply ask Postgres?

select * from pg_get_keywords();

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Re: GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
On Monday 3. May 2010 23.50.55 Alvaro Herrera wrote:

> Why wouldn't you simply ask Postgres?

Because I didn't know how :D That's why we've got this wonderful list, isn't 
it?
 
> select * from pg_get_keywords();

Cool! Thank you! I really only need the 'word' column. I'll separate the data 
types from the rest of the keywords, though.

Now I only need a list of the built-in functions. There doesn't seem to be a 
pg_get functions()?

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/

Re: GeSHi module for Postgresql?

От:
Yeb Havinga <yebhavinga@gmail.com>
Дата:
Leif Biberg Kristensen wrote:
> Now I only need a list of the built-in functions. There doesn't seem to be a 
> pg_get functions()?
>   
Try psql -E postgres
(-E shows all queries psql does on the catalog)

then \df

regards,
Yeb Havinga

Re: GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
On Tuesday 4. May 2010 08.20.56 Yeb Havinga wrote:
> Leif Biberg Kristensen wrote:
> > Now I only need a list of the built-in functions. There doesn't seem to be 
a 
> > pg_get functions()?
> >   
> Try psql -E postgres
> (-E shows all queries psql does on the catalog)
> 
> then \df

Thanks, Yeb.

I'm starting to get second thoughts about including a full function list; 
there's a myriad of functions of which I guess nobody (except for Tom Lane of 
course) has a full overview.

It's probably better to provide a short list of the most common functions, and 
then let users add to it according to their own domain of usage.

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/

Re: GeSHi module for Postgresql?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Leif Biberg Kristensen  writes:
> Now I only need a list of the built-in functions.

There's an awful lot of them, many of which aren't really intended to be
called by users anyway.  Can't you just do "if it looks syntactically
like a function call, assume it is one"?

			regards, tom lane

Re: GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
On Tuesday 4. May 2010 16.31.20 Tom Lane wrote:
> Leif Biberg Kristensen  writes:
> > Now I only need a list of the built-in functions.
> 
> There's an awful lot of them, many of which aren't really intended to be
> called by users anyway.  Can't you just do "if it looks syntactically
> like a function call, assume it is one"?

As the FAQ points out, «GeSHi is not a lexical parser, unlike other 
highlighting solutions.»  So, that's not 
really feasible the way GeSHi is built. That said, I've already compiled a 
list of most of the functions from the documentation. I only omitted system 
administration functions which may be postponed for a later version. I've 
submitted a preliminary draft of a Postgresql language file, and am waiting for 
a reply.

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/

Re: GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
On Tuesday 4. May 2010 16.31.20 Tom Lane wrote:
> Leif Biberg Kristensen  writes:
> > Now I only need a list of the built-in functions.
> 
> There's an awful lot of them, many of which aren't really intended to be
> called by users anyway.  Can't you just do "if it looks syntactically
> like a function call, assume it is one"?

Another point: I'm uncertain how to define a «user» in this context. Someone 
who wants to highlight plpgsql code snippets is most likely to be some kind of 
developer.

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/

Re: GeSHi module for Postgresql?

От:
Alvaro Herrera <alvherre@commandprompt.com>
Дата:
Leif Biberg Kristensen wrote:
> On Tuesday 4. May 2010 16.31.20 Tom Lane wrote:
> > Leif Biberg Kristensen  writes:
> > > Now I only need a list of the built-in functions.
> > 
> > There's an awful lot of them, many of which aren't really intended to be
> > called by users anyway.  Can't you just do "if it looks syntactically
> > like a function call, assume it is one"?
> 
> Another point: I'm uncertain how to define a «user» in this context. Someone 
> who wants to highlight plpgsql code snippets is most likely to be some kind of 
> developer.

He means stuff that's intended to be called externally, i.e. not
system internal functions.  A developer writing plpgsql is certainly a
"user".

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: GeSHi module for Postgresql?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Leif Biberg Kristensen  writes:
> On Tuesday 4. May 2010 16.31.20 Tom Lane wrote:
>> There's an awful lot of them, many of which aren't really intended to be
>> called by users anyway.  Can't you just do "if it looks syntactically
>> like a function call, assume it is one"?

> Another point: I'm uncertain how to define a �user� in this context. Someone 
> who wants to highlight plpgsql code snippets is most likely to be some kind of 
> developer.

Sure, but what I meant was "not intended to be called directly from
SQL".  Lots of those functions underlie operators, for example, and
you're really expected to use the operator instead.  Stuff like
btree support functions likewise not really intended to be called
manually.

			regards, tom lane

Re: GeSHi module for Postgresql?

От:
Leif Biberg Kristensen <leif@solumslekt.org>
Дата:
On Tuesday 4. May 2010 18.05.02 Tom Lane wrote:
> Leif Biberg Kristensen  writes:
> > Another point: I'm uncertain how to define a «user» in this context. 
Someone 
> > who wants to highlight plpgsql code snippets is most likely to be some 
kind of 
> > developer.
> 
> Sure, but what I meant was "not intended to be called directly from
> SQL".  Lots of those functions underlie operators, for example, and
> you're really expected to use the operator instead.  Stuff like
> btree support functions likewise not really intended to be called
> manually.

Yes, I think we are agreed. See also my earlier reply to Yeb Havinga, where I 
expressed some second thoughts about including a full function list. I think 
that the «public» functions included in the docs are sufficient for most 
purposes. There aren't an awful lot of them; I compiled a list by hand in a 
couple of hours.

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/blog/
FAQ