pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SQL formatter?
4+ messages / 3 participants
[nested] [flat]

* SQL formatter?
@ 2002-09-25 17:44  Andrew Perrin <clists@perrin.socsci.unc.edu>
  0 siblings, 1 reply; 4+ messages in thread

From: Andrew Perrin @ 2002-09-25 17:44 UTC (permalink / raw)
  To: pgsql-sql

Does anyone know of a routine for formatting SQL statements in a
structured way? Standalone or for emacs would be fine.  I'm thinking of
something that could take a long SQL text statement and format it, e.g.:

select foo from bar where baz and bop and not boo;

becomes

SELECT     foo
FROM       bar
WHERE      baz
   AND     bop
   AND NOT boo
;

Thanks,
Andy

----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: SQL formatter?
@ 2002-09-25 20:19  Philip Hallstrom <philip@adhesivemedia.com>
  parent: Andrew Perrin <clists@perrin.socsci.unc.edu>
  0 siblings, 1 reply; 4+ messages in thread

From: Philip Hallstrom @ 2002-09-25 20:19 UTC (permalink / raw)
  To: Andrew Perrin <clists@perrin.socsci.unc.edu>; +Cc: pgsql-sql

Looks to be windows based, but...

http://www.techno-kitten.com/PBL_Peeper/Online_Manual/SQL_Formatter/sql_formatter.html

first hit when searching on google for "sql formatter".  there were a lot
of other options...

You might look at how some of those C code indenter's work.  Seems like
some of them support multiple languages which means they maybe have some
sort of "language definition" so maybe you could just write a sql one and
it would just work.  Of course I've never used one and don't know anything
about it really so I could be wrong :)

-philip

On Wed, 25 Sep 2002, Andrew Perrin wrote:

> Does anyone know of a routine for formatting SQL statements in a
> structured way? Standalone or for emacs would be fine.  I'm thinking of
> something that could take a long SQL text statement and format it, e.g.:
>
> select foo from bar where baz and bop and not boo;
>
> becomes
>
> SELECT     foo
> FROM       bar
> WHERE      baz
>    AND     bop
>    AND NOT boo
> ;
>
> Thanks,
> Andy
>
> ----------------------------------------------------------------------
> Andrew J Perrin - http://www.unc.edu/~aperrin
> Assistant Professor of Sociology, U of North Carolina, Chapel Hill
> clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: SQL formatter?
@ 2002-09-26 15:49  Andrew Perrin <clists@perrin.socsci.unc.edu>
  parent: Philip Hallstrom <philip@adhesivemedia.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Andrew Perrin @ 2002-09-26 15:49 UTC (permalink / raw)
  To: Philip Hallstrom <philip@adhesivemedia.com>; +Cc: pgsql-sql

Unfortunately it is Windows based. The emacs mode for SQL is pretty
primitive too. Oh well - maybe I'll write one someday.

Thanks,
Andy

----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu


On Wed, 25 Sep 2002, Philip Hallstrom wrote:

> Looks to be windows based, but...
> 
> http://www.techno-kitten.com/PBL_Peeper/Online_Manual/SQL_Formatter/sql_formatter.html
> 
> first hit when searching on google for "sql formatter".  there were a lot
> of other options...
> 
> You might look at how some of those C code indenter's work.  Seems like
> some of them support multiple languages which means they maybe have some
> sort of "language definition" so maybe you could just write a sql one and
> it would just work.  Of course I've never used one and don't know anything
> about it really so I could be wrong :)
> 
> -philip
> 
> On Wed, 25 Sep 2002, Andrew Perrin wrote:
> 
> > Does anyone know of a routine for formatting SQL statements in a
> > structured way? Standalone or for emacs would be fine.  I'm thinking of
> > something that could take a long SQL text statement and format it, e.g.:
> >
> > select foo from bar where baz and bop and not boo;
> >
> > becomes
> >
> > SELECT     foo
> > FROM       bar
> > WHERE      baz
> >    AND     bop
> >    AND NOT boo
> > ;
> >
> > Thanks,
> > Andy
> >
> > ----------------------------------------------------------------------
> > Andrew J Perrin - http://www.unc.edu/~aperrin
> > Assistant Professor of Sociology, U of North Carolina, Chapel Hill
> > clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
> >
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: SQL formatter?
@ 2002-09-29 03:08  Andrew G. Hammond <drew@xyzzy.dhs.org>
  parent: Andrew Perrin <clists@perrin.socsci.unc.edu>
  0 siblings, 0 replies; 4+ messages in thread

From: Andrew G. Hammond @ 2002-09-29 03:08 UTC (permalink / raw)
  To: Andrew Perrin <clists@perrin.socsci.unc.edu>; +Cc: Philip Hallstrom <philip@adhesivemedia.com>; pgsql-sql

There's a tool called TXL that, given an SQL grammar can pretty print 
it.  (a semantically aware code transformation tool is massive overkill 
for the job, but what the hell... :)

Andrew Perrin wrote:

>Unfortunately it is Windows based. The emacs mode for SQL is pretty
>primitive too. Oh well - maybe I'll write one someday.
>
>Thanks,
>Andy
>
>----------------------------------------------------------------------
>Andrew J Perrin - http://www.unc.edu/~aperrin
>Assistant Professor of Sociology, U of North Carolina, Chapel Hill
>clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu
>
>
>On Wed, 25 Sep 2002, Philip Hallstrom wrote:
>
>  
>
>>Looks to be windows based, but...
>>
>>http://www.techno-kitten.com/PBL_Peeper/Online_Manual/SQL_Formatter/sql_formatter.html
>>
>>first hit when searching on google for "sql formatter".  there were a lot
>>of other options...
>>
>>You might look at how some of those C code indenter's work.  Seems like
>>some of them support multiple languages which means they maybe have some
>>sort of "language definition" so maybe you could just write a sql one and
>>it would just work.  Of course I've never used one and don't know anything
>>about it really so I could be wrong :)
>>
>>-philip
>>
>>On Wed, 25 Sep 2002, Andrew Perrin wrote:
>>
>>    
>>
>>>Does anyone know of a routine for formatting SQL statements in a
>>>structured way? Standalone or for emacs would be fine.  I'm thinking of
>>>something that could take a long SQL text statement and format it, e.g.:
>>>
>>>select foo from bar where baz and bop and not boo;
>>>
>>>becomes
>>>
>>>SELECT     foo
>>>FROM       bar
>>>WHERE      baz
>>>   AND     bop
>>>   AND NOT boo
>>>;
>>>
>>>Thanks,
>>>Andy
>>>
>>>----------------------------------------------------------------------
>>>Andrew J Perrin - http://www.unc.edu/~aperrin
>>>Assistant Professor of Sociology, U of North Carolina, Chapel Hill
>>>clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu
>>>
>>>
>>>
>>>---------------------------(end of broadcast)---------------------------
>>>TIP 5: Have you checked our extensive FAQ?
>>>
>>>http://www.postgresql.org/users-lounge/docs/faq.html
>>>
>>>      
>>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 5: Have you checked our extensive FAQ?
>>
>>http://www.postgresql.org/users-lounge/docs/faq.html
>>
>>    
>>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>  
>




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-09-29 03:08 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-25 17:44 SQL formatter? Andrew Perrin <clists@perrin.socsci.unc.edu>
2002-09-25 20:19 ` Philip Hallstrom <philip@adhesivemedia.com>
2002-09-26 15:49   ` Andrew Perrin <clists@perrin.socsci.unc.edu>
2002-09-29 03:08     ` Andrew G. Hammond <drew@xyzzy.dhs.org>

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