Sindre
Sindre9mo ago

postgres sql bind varaiables

select now() - interval '$1' as end is there a way to get $1 to work
No description
6 Replies
rubenf
rubenf9mo ago
yes, $1::text
Sindre
SindreOP9mo ago
Wow. nice AI! thanks
No description
Sindre
SindreOP9mo ago
haha. but it did not work :\
Sindre
SindreOP9mo ago
did not work either. but then I guess it just how it is
No description
rubenf
rubenf9mo ago
1 year but let me find the fix this works: select interval '1'::text ' year'; so try this: ``` select interval $1::text ' year';
```
select concat($1::text, ' year')::interval;
```
select concat($1::text, ' year')::interval;
Sindre
SindreOP9mo ago
thanks! that worked
No description