(self)
| 166 | self.assert_data_shape(res, tb.bag([['Briefing (new)']])) |
| 167 | |
| 168 | async def test_sql_dml_insert_05(self): |
| 169 | # insert link |
| 170 | await self.scon.execute('INSERT INTO "User" DEFAULT VALUES;') |
| 171 | await self.scon.execute( |
| 172 | 'INSERT INTO "Document" (owner_id) SELECT id FROM "User" LIMIT 1' |
| 173 | ) |
| 174 | res = await self.squery_values('SELECT owner_id FROM "Document"') |
| 175 | self.assert_shape(res, rows=1, columns=1) |
| 176 | |
| 177 | # insert multiple |
| 178 | await self.scon.execute('INSERT INTO "User" DEFAULT VALUES;') |
| 179 | await self.scon.execute( |
| 180 | 'INSERT INTO "Document" (owner_id) SELECT id FROM "User"' |
| 181 | ) |
| 182 | res = await self.squery_values('SELECT owner_id FROM "Document"') |
| 183 | self.assert_shape(res, rows=3, columns=1) |
| 184 | |
| 185 | # insert a null link |
| 186 | await self.scon.execute( |
| 187 | 'INSERT INTO "Document" (owner_id) VALUES (NULL)' |
| 188 | ) |
| 189 | |
| 190 | # insert multiple, with nulls |
| 191 | await self.scon.execute( |
| 192 | ''' |
| 193 | INSERT INTO "Document" (owner_id) VALUES |
| 194 | ((SELECT id from "User" LIMIT 1)), |
| 195 | (NULL) |
| 196 | ''' |
| 197 | ) |
| 198 | |
| 199 | async def test_sql_dml_insert_06(self): |
| 200 | # insert in a subquery: syntax error |
nothing calls this directly
no test coverage detected