Skip to content

empty variables not shown in \raw #257

@kenshaw

Description

@kenshaw

Empty variables should show in \raw.

For example, currently usql produces the following output:

(not connected)=> \set a ''
(not connected)=> select :a
(not connected)-> \p
select 
(not connected)-> \raw
select 
(not connected)->

However, on the \raw above, it should have shown:

(not connected)-> \raw
select :a
(not connected)->

Comparatively:

(not connected)=> \set a b
(not connected)=> select :a
(not connected)-> \p
select b
(not connected)-> \raw
select :a
(not connected)->

And, it behaves as expected for quoted variables:

(not connected)=> \set a ''
(not connected)=> select :'a'
(not connected)-> \p
select ''
(not connected)-> \raw
select :'a'
(not connected)->

It's worth noting this is not dependent on the length of the variable name:

(not connected)=> select :aa
(not connected)-> \p
select 
(not connected)-> \raw
select 
(not connected)-> 

The reason for this behavior is partly due to the original way that variables were parsed and interpolated (at time of entry). This will require a slight overhaul to how variables are captured and interpolated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions