2009/3/11 Dave Page <dpage@pgadmin.org>:
> Testing on Windows, it fails the first tests I try :-(
>
> select * from missing_table
>
> I get no error message at all. If I enter garbage, I just get the following:
>
> 1.0: syntax error, unexpected character
This is normal: you do not have anything in the output because the
query must be terminated with a semi-colon.
I will look at that and add an error message.
Add the semi-colon ";" and the query will be executed. An erroneous
query (like this one where the table does not exist) is valid from the
pgScript point of view. It returns a warning saying why the query did
not work but does not stop. I wanted to do like this because sometimes
with pgScript I test invalid queries and I do not want the script to
be stopped.
> If I enter this example from the docs:
>
> SET @A = INTEGER(100, 200);
> PRINT @A; -- Prints an integer between 100 and 200
> PRINT @A; -- Prints another integer between 100 and 200
>
> I get:
>
> 3.9-10: syntax error, unexpected '-'
Add an empty line at the end and the error will go away. This is the
way pgScript detects comments: the regular expression doing that is
"--".*$. I need to see if I can add "End of file" is addition to "$".
> I would expect an error message from the first query, and nicely
> formatted errors from the second and third tests (though actually I
> wouldn't expect an error at all from the docs example). FWIW, other
> (non-erroring) examples work fine:
I need to check whether I can modify how Bison outputs errors in case
a parsing error occurs.
> SET @PROGR@M#TITLE = 'pgScript';
> PRINT '';
> PRINT @PROGR@M#TITLE + ' features:';
> PRINT '';
> PRINT ' * Regular PostgreSQL commands';
> PRINT ' * Control-of-flow language';
> PRINT ' * Local variables';
> PRINT ' * Random data generators';
>
> gives:
>
> [PGSCRIPT ]
> [PGSCRIPT ] pgScript features:
> [PGSCRIPT ]
> [PGSCRIPT ] * Regular PostgreSQL commands
> [PGSCRIPT ] * Control-of-flow language
> [PGSCRIPT ] * Local variables
> [PGSCRIPT ] * Random data generators
>
> and
>
> DECLARE @I, @T; -- Variable names begin with a @
> SET @I = 0; -- @I is an integer
> WHILE @I < 20
> BEGIN
> SET @T = 'table' + CAST (@I AS STRING); -- Casts @I
> CREATE TABLE @T (id integer primary key, data text);
>
> SET @I = @I + 1;
> END
>
> Outputs the queries and resulting notices as expected.
>
The problem you mentioned are things to improve but they have always
been there and not linked to a recent patch.
Best regards,
Mickael